item.state is not always defined.

This commit is contained in:
Andrea Dell'Amico 2024-03-20 16:02:34 +01:00
parent 9f2eaa9b80
commit 680cfec5af
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
1 changed files with 4 additions and 4 deletions

View File

@ -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']