From 8cf92530c3ed9718fb97d00e383a6c2e17275775 Mon Sep 17 00:00:00 2001 From: Alexandre Le Gall Date: Tue, 10 Oct 2023 11:19:42 +0200 Subject: [PATCH] [EVO] Manager wiregard as kernel module --- tasks/configuration.yml | 21 --------------------- tasks/installation.yml | 20 +++++++++++--------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/tasks/configuration.yml b/tasks/configuration.yml index 4cc2517..ac76787 100644 --- a/tasks/configuration.yml +++ b/tasks/configuration.yml @@ -19,24 +19,3 @@ notify: - Activer les services - Redémarrer les services - -#- 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 }} diff --git a/tasks/installation.yml b/tasks/installation.yml index d6fc101..b5191a5 100644 --- a/tasks/installation.yml +++ b/tasks/installation.yml @@ -1,6 +1,14 @@ --- # tasks file for wireguard +- name: Vérifier si le module du noyau est chargé + ansible.builtin.command: + cmd: lsmod + register: lsmod + +- debug: + var: lsmod + - name: Installer le paquet ansible.builtin.apt: update_cache: true @@ -13,7 +21,9 @@ ansible.builtin.apt: update_cache: true name: wireguard-dkms - when: wireguard_module_host | length > 0 + when: + - lsmod.stdout | regex_search('wireguard') + - wireguard_module_host | length > 0 delegate_to: "{{ wireguard_module_host }}" become: true @@ -23,11 +33,3 @@ name: wireguard-tools when: wireguard_module_host | length > 0 become: true - -#- name: Créer le dossier contenant la configuration -# ansible.builtin.file: -# state: directory -# mode: u=rwx,g=,o= -# path: "{{ wireguard_conf_path }}" -# delegate_to: "{{ wireguard_server_host }}" -# become: true