diff --git a/tasks/container.yml b/tasks/container.yml new file mode 100644 index 0000000..084418f --- /dev/null +++ b/tasks/container.yml @@ -0,0 +1,22 @@ +--- +# tasks file for wireguard + +- name: Tâches de gestion du module du noyau + block: + - name: Charger le module du noyau + community.general.modprobe: + name: wireguard + state: present + rescue: + - name: Installer le module du noyau sur l'hôte + ansible.builtin.apt: + update_cache: true + name: wireguard-dkms + become: true + delegate_to: "{{ wireguard_module_host }}" + +- name: Installer l'outil de configuration + ansible.builtin.apt: + update_cache: true + name: wireguard-tools + become: true diff --git a/tasks/main.yml b/tasks/main.yml index 6ba1629..0a690fb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,27 +8,10 @@ when: wireguard_module_host | length == 0 become: true -- name: Tâches de gestion du module du noyau - block: - - name: Charger le module du noyau - community.general.modprobe: - name: wireguard - state: present - rescue: - - name: Installer le module du noyau sur l'hôte - ansible.builtin.apt: - update_cache: true - name: wireguard-dkms +- name: Importer les tâches spécifique aux conteneurs + ansible.builtin.import_tasks: + file: container.yml when: wireguard_module_host | length > 0 - become: true - delegate_to: "{{ wireguard_module_host }}" - -- name: Installer l'outil de configuration - ansible.builtin.apt: - update_cache: true - name: wireguard-tools - when: wireguard_module_host | length > 0 - become: true - name: Déployer la configuration des interfaces ansible.builtin.template: