diff --git a/tasks/user_accounts.yml b/tasks/user_accounts.yml index bb08139ef..974fe2805 100644 --- a/tasks/user_accounts.yml +++ b/tasks/user_accounts.yml @@ -10,17 +10,19 @@ - name: calculate UID_MAX from UID_MIN by substracting 1 set_fact: uid_max: '{{ uid_min.stdout | int - 1 }}' - when: uid_min is defined + when: uid_min.stdout|int > 0 - name: set UID_MAX on Debian-systems if no login.defs exist set_fact: uid_max: '999' - when: ansible_facts.os_family == 'Debian' and not uid_min + when: + - ansible_facts.os_family == 'Debian' + - uid_max is not defined - name: set UID_MAX on other systems if no login.defs exist set_fact: uid_max: '499' - when: not uid_min + when: uid_max is not defined - name: get all system accounts command: awk -F'':'' '{ if ( $3 <= {{ uid_max|quote }} ) print $1}' /etc/passwd