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

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5385070C.7020503%40king.net.nz.
For more options, visit https://groups.google.com/d/optout.

Reply via email to