role_wireguard/tasks/main.yml

34 lines
779 B
YAML
Raw Normal View History

2023-04-13 07:25:26 +00:00
---
# tasks file for wireguard
- name: Installer le paquet
ansible.builtin.apt:
update_cache: true
name: wireguard
when: wireguard_module_host | length == 0
become: true
2023-04-13 07:25:26 +00:00
2024-02-16 09:50:24 +00:00
- name: Importer les tâches spécifique aux conteneurs
ansible.builtin.import_tasks:
file: container.yml
when: wireguard_module_host | length > 0
- 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