2023-04-13 07:25:26 +00:00
|
|
|
---
|
|
|
|
# tasks file for wireguard
|
|
|
|
|
|
|
|
- name: Déployer la configuration des interfaces
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: wgN.j2
|
|
|
|
dest: /etc/wireguard/{{ interface }}.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
loop: "{{ wireguard_interfaces }}"
|
|
|
|
loop_control:
|
|
|
|
index_var: index
|
|
|
|
label: "{{ interface }}"
|
|
|
|
vars:
|
|
|
|
interface: wg{{ index }}
|
|
|
|
become: true
|
|
|
|
register: deploy
|
2023-05-03 14:12:42 +00:00
|
|
|
notify:
|
|
|
|
- Activer les services
|
|
|
|
- Redémarrer les services
|
2023-04-13 07:25:26 +00:00
|
|
|
|
2023-05-03 14:12:42 +00:00
|
|
|
#- name: Activer les services
|
|
|
|
# ansible.builtin.systemd:
|
|
|
|
# state: restarted
|
|
|
|
# enabled: true
|
|
|
|
# name: wg-quick@wg{{ item }}.service
|
|
|
|
# become: true
|
|
|
|
# loop: "{{ deploy.results | selectattr('changed', 'equalto', true) | map(attribute='index') }}"
|
|
|
|
# loop_control:
|
|
|
|
# index_var: index
|
|
|
|
# label: wg{{ index }}
|
|
|
|
#
|
|
|
|
#- name: Redémarrer les services
|
|
|
|
# ansible.builtin.systemd:
|
|
|
|
# state: restarted
|
|
|
|
# name: wg-quick@wg{{ item }}.service
|
|
|
|
# become: true
|
|
|
|
# loop: "{{ deploy.results | selectattr('changed', 'equalto', true) | map(attribute='index') }}"
|
|
|
|
# loop_control:
|
|
|
|
# index_var: index
|
|
|
|
# label: wg{{ index }}
|