role_wireguard/tasks/configuration.yml

43 lines
1.1 KiB
YAML
Raw Normal View History

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
notify:
- Activer les services
- Redémarrer les services
2023-04-13 07:25:26 +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 }}