Currently I add system users with the following play:
#
# Create system users
#
- name: sys admin users
tags: sys_admin_users
user: name={{ userdef[item].name }} uid={{ userdef[item].uid }} "groups={{ system_admins_groups|join(',') }}" "comment={{ userdef[item].comment }}" password={{ userdef[item].password }} update_password=on_create shell=/bin/bash
with_items: system_admins
userdef is a dictionary containing all users' details. system_admins is
a list of system admin users.
I'd prefer to have userdefs as a list and be able to write this as
something like:
- name: sys admin users
tags: sys_admin_users
user: name=
item.name uid=item.uid "groups={{ system_admins_groups|join(',') }}" "comment={{ item.comment }}" password=item.passwordupdate_password=on_create shell=/bin/bash
with_items: userdef
when:
item.name in system_admins
Mixing with_items and when doesn't currently seem possible. (Ansible 1.5.3)
Cheers,
Alex