Compare commits
2 Commits
d6e080d014
...
3cc5c7a773
Author | SHA1 | Date | |
---|---|---|---|
|
3cc5c7a773 | ||
|
149e630c47 |
@ -1,2 +1,12 @@
|
||||
[pt]
|
||||
ap33-pt
|
||||
|
||||
[wg]
|
||||
ap33-mon
|
||||
ap33-prod
|
||||
|
||||
[wg_master]
|
||||
ap33-mon
|
||||
|
||||
[wg_cli]
|
||||
ap33-prod
|
||||
|
@ -2,10 +2,17 @@
|
||||
set -u
|
||||
set -e
|
||||
|
||||
<<<<<<< HEAD
|
||||
AddressAwg=10.0.0.1/24 # Adresse VPN Wireguard extremite A
|
||||
EndpointA=172.16.0.122 # Adresse extremite A
|
||||
PortA=51820 # Port ecoute extremite A
|
||||
AddressBwg=10.0.0.2/24 # Adresse VPN Wireguard extremite B
|
||||
=======
|
||||
AddressAwg=172.16.0.1/24 # Adresse VPN Wireguard extremite A
|
||||
EndpointA=172.16.0.122 # Adresse extremite A
|
||||
PortA=51820 # Port ecoute extremite A
|
||||
AddressBwg=172.16.0.2/24 # Adresse VPN Wireguard extremite B
|
||||
>>>>>>> d6e080d0145615056a7a0eb3d2f9e512809eb4f5
|
||||
EndpointB=172.16.0.121 # Adresse extremite B
|
||||
PortB=51820 # Port ecoute extremite B
|
||||
|
||||
@ -21,7 +28,11 @@ pKA=$(cat endpoint-a.pub)
|
||||
PKB=$(cat endpoint-b.key)
|
||||
pKB=$(cat endpoint-b.pub)
|
||||
|
||||
<<<<<<< HEAD
|
||||
cat <<FINI > wg0-1.conf
|
||||
=======
|
||||
cat <<FINI > wg1-a.conf
|
||||
>>>>>>> d6e080d0145615056a7a0eb3d2f9e512809eb4f5
|
||||
# local settings for Endpoint A
|
||||
[Interface]
|
||||
PrivateKey = $PKA
|
||||
@ -35,7 +46,11 @@ Endpoint = ${EndpointB}:$PortB
|
||||
AllowedIPs = $AddressBwg
|
||||
FINI
|
||||
|
||||
<<<<<<< HEAD
|
||||
cat <<FINI > wg0-2.conf
|
||||
=======
|
||||
cat <<FINI > wg1-b.conf
|
||||
>>>>>>> d6e080d0145615056a7a0eb3d2f9e512809eb4f5
|
||||
# local settings for Endpoint B
|
||||
[Interface]
|
||||
PrivateKey = $PKB
|
||||
|
@ -1,5 +1,70 @@
|
||||
---
|
||||
- hosts: wg
|
||||
<<<<<<< HEAD
|
||||
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 et wg0-2.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
|
||||
|
||||
- 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"
|
||||
|
||||
- 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
|
||||
=======
|
||||
tasks:
|
||||
- name: installe Wireguard
|
||||
apt:
|
||||
@ -22,3 +87,4 @@
|
||||
tasks:
|
||||
- name: copie fichier
|
||||
|
||||
>>>>>>> d6e080d0145615056a7a0eb3d2f9e512809eb4f5
|
||||
|
Loading…
x
Reference in New Issue
Block a user