From ab5c3749901a6f4ec43df0ac0edffa791bc207d9 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sun, 22 Dec 2024 20:32:28 +0100 Subject: [PATCH] fix(wg): correct check for existing private key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Registering output of ‹ansible.builtin.stat› generates an object containing ‹stat› member itself. Signed-off-by: Matej Focko --- roles/wg/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/wg/tasks/main.yml b/roles/wg/tasks/main.yml index 1443325..f356d99 100644 --- a/roles/wg/tasks/main.yml +++ b/roles/wg/tasks/main.yml @@ -6,11 +6,11 @@ - name: Check for existence of private key ansible.builtin.stat: path: /etc/wireguard/private.key - register: _private_key_stat + register: _private_key - name: Generate keypair ansible.builtin.include_tasks: tasks/generate_keypair.yml - when: not _private_key_stat.exists + when: not _private_key.stat.exists - name: Save private key ansible.builtin.template: @@ -21,7 +21,7 @@ mode: 0700 vars: key: "{{ wg_private_key }}" - when: not _private_key_stat.exists + when: not _private_key.stat.exists - name: Save public key ansible.builtin.template: @@ -32,7 +32,7 @@ mode: 0700 vars: key: "{{ wg_public_key }}" - when: not _private_key_stat.exists + when: not _private_key.stat.exists - name: Set dns_command for co-openSUSE ansible.builtin.set_fact: