Compare commits
No commits in common. "b81cbb8021679b33af93da97475e8a9d11736709" and "d29ce732af0fce68c555df54563113473c3a0c5b" have entirely different histories.
b81cbb8021
...
d29ce732af
BIN
ansible/.wg.yml.swp
Normal file
BIN
ansible/.wg.yml.swp
Normal file
Binary file not shown.
@ -1,11 +1,14 @@
|
|||||||
|
[pt]
|
||||||
|
ap33-pt
|
||||||
|
|
||||||
[wg]
|
[wg]
|
||||||
|
ap33-mon
|
||||||
ap33-prod
|
ap33-prod
|
||||||
ap33-test
|
ap33-test
|
||||||
ap33-mon
|
|
||||||
|
|
||||||
[wg_master]
|
[wg_master]
|
||||||
ap33-mon
|
ap33-mon
|
||||||
|
|
||||||
[wg_cli]
|
[wg_cli]
|
||||||
ap33-test
|
|
||||||
ap33-prod
|
ap33-prod
|
||||||
|
ap33-test
|
@ -6,15 +6,8 @@ AddressAwg=10.0.0.1/24 # Adresse VPN Wireguard extremite A
|
|||||||
EndpointA=172.16.0.122 # Adresse extremite A
|
EndpointA=172.16.0.122 # Adresse extremite A
|
||||||
PortA=51820 # Port ecoute extremite A
|
PortA=51820 # Port ecoute extremite A
|
||||||
AddressBwg=10.0.0.2/24 # Adresse VPN Wireguard extremite B
|
AddressBwg=10.0.0.2/24 # Adresse VPN Wireguard extremite B
|
||||||
<<<<<<< HEAD:ansible/wireguard/mkwgconf.sh
|
|
||||||
EndpointB=172.16.0.120 # Adresse extremite B
|
|
||||||
=======
|
|
||||||
EndpointB=172.16.0.121 # Adresse extremite B
|
EndpointB=172.16.0.121 # Adresse extremite B
|
||||||
>>>>>>> d29ce732af0fce68c555df54563113473c3a0c5b:ansible/mkwgconf.sh
|
|
||||||
PortB=51820 # Port ecoute extremite B
|
PortB=51820 # Port ecoute extremite B
|
||||||
AddressCwg=10.0.0.3/24 # Adresse VPN Wireguard extremite C
|
|
||||||
EndpointC=172.16.0.121 # Adresse extremite C
|
|
||||||
PortC=51820 # Port ecoute extremite C
|
|
||||||
|
|
||||||
umask 077 ;
|
umask 077 ;
|
||||||
wg genkey > endpoint-a.key
|
wg genkey > endpoint-a.key
|
||||||
@ -23,15 +16,10 @@ wg pubkey < endpoint-a.key > endpoint-a.pub
|
|||||||
wg genkey > endpoint-b.key
|
wg genkey > endpoint-b.key
|
||||||
wg pubkey < endpoint-b.key > endpoint-b.pub
|
wg pubkey < endpoint-b.key > endpoint-b.pub
|
||||||
|
|
||||||
wg genkey > endpoint-c.key
|
|
||||||
wg pubkey < endpoint-c.key > endpoint-c.pub
|
|
||||||
|
|
||||||
PKA=$(cat endpoint-a.key)
|
PKA=$(cat endpoint-a.key)
|
||||||
pKA=$(cat endpoint-a.pub)
|
pKA=$(cat endpoint-a.pub)
|
||||||
PKB=$(cat endpoint-b.key)
|
PKB=$(cat endpoint-b.key)
|
||||||
pKB=$(cat endpoint-b.pub)
|
pKB=$(cat endpoint-b.pub)
|
||||||
PKC=$(cat endpoint-c.key)
|
|
||||||
pKC=$(cat endpoint-c.pub)
|
|
||||||
|
|
||||||
cat <<FINI > wg0-1.conf
|
cat <<FINI > wg0-1.conf
|
||||||
# local settings for Endpoint A
|
# local settings for Endpoint A
|
||||||
@ -45,12 +33,6 @@ ListenPort = $PortA
|
|||||||
PublicKey = $pKB
|
PublicKey = $pKB
|
||||||
Endpoint = ${EndpointB}:$PortB
|
Endpoint = ${EndpointB}:$PortB
|
||||||
AllowedIPs = $AddressBwg
|
AllowedIPs = $AddressBwg
|
||||||
|
|
||||||
# remote settings for Endpoint C
|
|
||||||
[Peer]
|
|
||||||
PublicKey = $pKC
|
|
||||||
Endpoint = ${EndpointC}:$PortC
|
|
||||||
AllowedIPs = $AddressCwg
|
|
||||||
FINI
|
FINI
|
||||||
|
|
||||||
cat <<FINI > wg0-2.conf
|
cat <<FINI > wg0-2.conf
|
||||||
@ -66,17 +48,3 @@ PublicKey = $pKA
|
|||||||
Endpoint = ${EndpointA}:$PortA
|
Endpoint = ${EndpointA}:$PortA
|
||||||
AllowedIPs = $AddressAwg
|
AllowedIPs = $AddressAwg
|
||||||
FINI
|
FINI
|
||||||
|
|
||||||
cat <<FINI > wg0-3.conf
|
|
||||||
#local settings for Endpoint C
|
|
||||||
[Interface]
|
|
||||||
PrivateKey = $PKC
|
|
||||||
Address = $AddressCwg
|
|
||||||
ListenPort = $PortC
|
|
||||||
|
|
||||||
# remote settings for Endpoint A
|
|
||||||
[Peer]
|
|
||||||
PublicKey = $pKA
|
|
||||||
Endpoint = ${EndpointA}:$PortA
|
|
||||||
AllowedIPs = $AddressAwg
|
|
||||||
FINI
|
|
@ -1,77 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: wg
|
|
||||||
become: yes
|
|
||||||
tasks:
|
|
||||||
- name: arrete unattended-upgrades
|
|
||||||
service:
|
|
||||||
name: unattended-upgrades
|
|
||||||
state: stopped
|
|
||||||
|
|
||||||
- name: installe Wireguard
|
|
||||||
apt:
|
|
||||||
name:
|
|
||||||
- wireguard
|
|
||||||
- wireguard-tools
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- hosts: wg_master
|
|
||||||
tasks:
|
|
||||||
- name: copie le fichier wg0-1.conf, wg0-2.conf et wg0-3.conf vers les machines master et cli
|
|
||||||
copy:
|
|
||||||
src: mkwgconf.sh
|
|
||||||
dest: mkwgconf.sh
|
|
||||||
|
|
||||||
- name: generations fichier configuration wireguard wg0-1.conf etc
|
|
||||||
shell: bash mkwgconf.sh
|
|
||||||
|
|
||||||
- name: récupération du fichier wg0-1.conf vers ap33-ans
|
|
||||||
fetch:
|
|
||||||
src: wg0-1.conf
|
|
||||||
dest: wg0-1.conf
|
|
||||||
flat: yes
|
|
||||||
|
|
||||||
- name: récupération du fichier wg0-2.conf vers ap33-ans
|
|
||||||
fetch:
|
|
||||||
src: wg0-2.conf
|
|
||||||
dest: wg0-2.conf
|
|
||||||
flat: yes
|
|
||||||
|
|
||||||
- name: récupération du fichier wg0-3.conf vers ap33-ans
|
|
||||||
fetch:
|
|
||||||
src: wg0-3.conf
|
|
||||||
dest: wg0-3.conf
|
|
||||||
flat: yes
|
|
||||||
|
|
||||||
- hosts: wg
|
|
||||||
become: yes
|
|
||||||
tasks:
|
|
||||||
- name: copie fichier wg0-1 vers les clients
|
|
||||||
copy:
|
|
||||||
src: wg0-1.conf
|
|
||||||
dest: /etc/wireguard/wg0.conf
|
|
||||||
when: ansible_hostname == "ap33-mon"
|
|
||||||
|
|
||||||
- name: copie fichier wg0-2 vers les clients
|
|
||||||
copy:
|
|
||||||
src: wg0-2.conf
|
|
||||||
dest: /etc/wireguard/wg0.conf
|
|
||||||
when: ansible_hostname == "ap33-prod"
|
|
||||||
|
|
||||||
- name: copie fichier wg0-3.conf vers les clients
|
|
||||||
copy:
|
|
||||||
src: wg0-3.conf
|
|
||||||
dest: /etc/wireguard/wg0.conf
|
|
||||||
when: ansible_hostname == "ap33-test"
|
|
||||||
|
|
||||||
- hosts: wg
|
|
||||||
become: yes
|
|
||||||
tasks:
|
|
||||||
- name: Activation de wireguard
|
|
||||||
service:
|
|
||||||
name: wg-quick@wg0.service
|
|
||||||
enabled: yes
|
|
||||||
|
|
||||||
- name: Redémarre le wireguard
|
|
||||||
service:
|
|
||||||
name: wg-quick@wg0.service
|
|
||||||
state: restarted
|
|
@ -1,17 +0,0 @@
|
|||||||
# local settings for Endpoint A
|
|
||||||
[Interface]
|
|
||||||
PrivateKey = CNafmAzvjGGAFA5RsDCHtypTh9RGnAxpkxZCt9cBkXo=
|
|
||||||
Address = 10.0.0.1/24
|
|
||||||
ListenPort = 51820
|
|
||||||
|
|
||||||
# remote settings for Endpoint B
|
|
||||||
[Peer]
|
|
||||||
PublicKey = UMlB4+d/SYufqAGbuHDvGvkOhGKEihIgR+rhFzk3Aj0=
|
|
||||||
Endpoint = 172.16.0.120:51820
|
|
||||||
AllowedIPs = 10.0.0.2/24
|
|
||||||
|
|
||||||
# remote settings for Endpoint C
|
|
||||||
[Peer]
|
|
||||||
PublicKey = EWOjtZLwhNLDokDWJCONaBtqpGbr+x5tzNFeUI0hHEE=
|
|
||||||
Endpoint = 172.16.0.121:51820
|
|
||||||
AllowedIPs = 10.0.0.3/24
|
|
@ -1,11 +0,0 @@
|
|||||||
# local settings for Endpoint B
|
|
||||||
[Interface]
|
|
||||||
PrivateKey = SLBteS7RJPIZ0TlZ5b9D6xtHF/5VzuQGmqnzW0Kkb0g=
|
|
||||||
Address = 10.0.0.2/24
|
|
||||||
ListenPort = 51820
|
|
||||||
|
|
||||||
# remote settings for Endpoint A
|
|
||||||
[Peer]
|
|
||||||
PublicKey = Fqd4WMaBpI7DAK6p2BaNhaE9VYzMRmfLxaO9uOmWTys=
|
|
||||||
Endpoint = 172.16.0.122:51820
|
|
||||||
AllowedIPs = 10.0.0.1/24
|
|
@ -1,11 +0,0 @@
|
|||||||
#local settings for Endpoint C
|
|
||||||
[Interface]
|
|
||||||
PrivateKey = wBu8AaHa061bI+6Eb+FmghV3iGKdp0a2Kq6At8UNzHo=
|
|
||||||
Address = 10.0.0.3/24
|
|
||||||
ListenPort = 51820
|
|
||||||
|
|
||||||
# remote settings for Endpoint A
|
|
||||||
[Peer]
|
|
||||||
PublicKey = Fqd4WMaBpI7DAK6p2BaNhaE9VYzMRmfLxaO9uOmWTys=
|
|
||||||
Endpoint = 172.16.0.122:51820
|
|
||||||
AllowedIPs = 10.0.0.1/24
|
|
Loading…
x
Reference in New Issue
Block a user