From 680cfec5afe7de5373ea6b3f1ef07b90bf940c78 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 20 Mar 2024 16:02:34 +0100 Subject: [PATCH] item.state is not always defined. --- tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 456d29d..236099a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -68,7 +68,7 @@ loop: '{{ users_system_users }}' when: - item.ssh_key is defined - - item.state == "present" + - item.state is defined and item.state != "present" - name: Add the admin users to the sudoers group ansible.builtin.user: @@ -78,7 +78,7 @@ loop: '{{ users_system_users }}' when: - item.admin - - item.state == "present" + - item.state is defined and item.state != "present" - name: Manage additional users tags: users @@ -110,7 +110,7 @@ loop: '{{ users_system_users_adjunct }}' when: - item.ssh_key is defined - - item.state == "present" + - item.state is defined and item.state != "present" - name: Add the additional admin users to the sudoers group ansible.builtin.user: @@ -120,7 +120,7 @@ loop: '{{ users_system_users_adjunct }}' when: - item.admin - - item.state == "present" + - item.state is defined and item.state != "present" - name: Configure passwordless sudo tags: ['users', 'sudo_wheel']