[EVO] Manager wiregard as kernel module

This commit is contained in:
pulsar89.5 2023-10-10 11:19:42 +02:00
parent f7aa5380e0
commit 8cf92530c3
2 changed files with 11 additions and 30 deletions

View File

@ -19,24 +19,3 @@
notify: notify:
- Activer les services - Activer les services
- Redémarrer 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 }}

View File

@ -1,6 +1,14 @@
--- ---
# tasks file for wireguard # 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 - name: Installer le paquet
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
@ -13,7 +21,9 @@
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
name: wireguard-dkms 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 }}" delegate_to: "{{ wireguard_module_host }}"
become: true become: true
@ -23,11 +33,3 @@
name: wireguard-tools name: wireguard-tools
when: wireguard_module_host | length > 0 when: wireguard_module_host | length > 0
become: true 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