diff --git a/ansible/hosts b/ansible/hosts deleted file mode 100644 index aff0ea3..0000000 --- a/ansible/hosts +++ /dev/null @@ -1,3 +0,0 @@ -[pt] -ap33-pt - diff --git a/ansible/wg.yml b/ansible/wg.yml new file mode 100644 index 0000000..8fb6120 --- /dev/null +++ b/ansible/wg.yml @@ -0,0 +1,65 @@ +--- +- 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 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 diff --git a/ansible/wireguard/mkwgconf.sh b/ansible/wireguard/mkwgconf.sh index ac7f054..760bc5b 100644 --- a/ansible/wireguard/mkwgconf.sh +++ b/ansible/wireguard/mkwgconf.sh @@ -6,7 +6,11 @@ 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 +<<<<<<< HEAD:ansible/wireguard/mkwgconf.sh EndpointB=172.16.0.120 # Adresse extremite B +======= +EndpointB=172.16.0.121 # Adresse extremite B +>>>>>>> d29ce732af0fce68c555df54563113473c3a0c5b:ansible/mkwgconf.sh 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