Ajout des fichiers VPN
This commit is contained in:
60
partie2/ansible/wg.yml
Normal file
60
partie2/ansible/wg.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
- name: WireGuard pour apx31-prod et apx31-test
|
||||
hosts:
|
||||
- ap31-test
|
||||
- ap31-prod
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Installer WireGuard
|
||||
apt:
|
||||
name:
|
||||
- wireguard
|
||||
- wireguard-tools
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Copier le script mkwgconf-p2p.sh dans /tmp
|
||||
ansible.builtin.copy:
|
||||
src: mkwgconf-p2p.sh
|
||||
dest: /tmp/mkwgconf-p2p.sh
|
||||
mode: '0755'
|
||||
|
||||
- name: Executer le script mkwgconf
|
||||
ansible.builtin.shell:
|
||||
cmd: cd /tmp && /tmp/mkwgconf-p2p.sh
|
||||
when: inventory_hostname == "ap31-test"
|
||||
|
||||
- name: Recupere wg0-a.conf
|
||||
ansible.builtin.fetch:
|
||||
src: /tmp/wg0-a.conf
|
||||
dest: /tmp/
|
||||
# mode: '0600'
|
||||
flat: yes
|
||||
when: inventory_hostname == "ap31-test"
|
||||
|
||||
- name: Recupere wg0-b.conf
|
||||
ansible.builtin.fetch:
|
||||
src: /tmp/wg0-b.conf
|
||||
dest: /tmp/
|
||||
# mode: '0600'
|
||||
flat: yes
|
||||
when: inventory_hostname == "ap31-test"
|
||||
|
||||
- name: Renvoi wg0-a.conf
|
||||
ansible.builtin.copy:
|
||||
src: /tmp/wg0-a.conf
|
||||
dest: /etc/wireguard/wg0.conf
|
||||
# mode: '0600'
|
||||
when: inventory_hostname == "ap31-test"
|
||||
|
||||
- name: Renvoi wg0-b.conf
|
||||
ansible.builtin.copy:
|
||||
src: /tmp/wg0-b.conf
|
||||
dest: /etc/wireguard/wg0.conf
|
||||
#mode: '0600'
|
||||
when: inventory_hostname == "ap31-prod"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user