From 9c0f2ff86f1e7fd165d9d844cf5651cd32bb06fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bourqui?= Date: Fri, 18 Oct 2019 19:54:10 +0200 Subject: [PATCH] add tag, and cleanup --- tasks/main.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index d5a8af4..a311ef9 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -14,7 +14,6 @@ - wireguard-tools tags: - wg-install - - skip_ansible_lint - name: Enable WireGuard kernel module modprobe: @@ -42,21 +41,22 @@ - name: Generate WireGuard private key shell: "wg genkey" register: wg_private_key_result + when: not config_file_stat.stat.exists tags: - wg-generate-keys - - skip_ansible_lint - when: not config_file_stat.stat.exists - name: Read WireGuard config file slurp: src: "{{ wireguard_remote_directory }}/{{ wireguard_interface }}.conf" register: wg_config + tags: + - wg-config - name: Set private key fact set_fact: private_key: "{{ wg_config['content'] | b64decode | regex_findall('PrivateKey = (.*)') | first }}" tags: - wg-config + - wg-config - name: Derive WireGuard public key shell: "echo '{{ private_key }}' | wg pubkey" @@ -69,7 +69,7 @@ set_fact: public_key: "{{ wg_public_key_result.stdout }}" tags: - wg-config + - wg-config - name: Create WireGuard configuration directory file: @@ -95,12 +95,16 @@ stat: path: "{{ wireguard_remote_directory }}/.reload-module-on-update" register: reload_module_on_update + tags: + - wg-config - name: Set WireGuard reload-module-on-update file: dest: "{{ wireguard_remote_directory }}/.reload-module-on-update" state: touch when: not reload_module_on_update.stat.exists + tags: + - wg-config - name: Start and enable WireGuard service service: @@ -114,3 +118,5 @@ state: absent delegate_to: localhost run_once: true + tags: + - wg-config