I have a list of dictionaries containing user details. Some of them need specific UIDs, but most of them don't.
Example:
# list_of_dictionaries__users
- { name: user1, uid: 654, group: user1 }
- { name: user2, group: user2 }
- { name: user3, group: user3 }
- { name: user4, group: user4 }
- { name: user5, uid: 657, group: user5 }
When I use the Ansible user module in a loop like this,
- name: Ensure user existence
user:
name: {{ item.name }}
uid: {{ item.uid | default('ANY_UID')}}
group: {{ item.group }}
loop: {{ list_of_dictionaries__users }}
I don't know how to tell ansible to treat the uid parameter as if it wasn't set at all, that is, to assign whatever UID linux gives it.
Any ideas?