I would like to be able to put my users into a list and be able to select
what user has access to each machine.
---
- name: Set up users
hosts: localhost
gather_facts: no
vars:
- alice:
name: Alice Appleworth
mail: [email protected]
pass: ..hash...
- bob:
name: Bob Bananarama
mail: [email protected]
pass: ..hash..
mail:
tasks:
- name: Add user
debug: msg="Add user {{ item.key }} password {{ item.pass }}"
with_items:
- "{{ alice }}"
I am not able to figure out how to get the user name, ie "alice" as
item.key is not valid. I think this is because using "{{ alice }}" does not
preserve the name. Does anyone know how I can structure this? I've tried
putting them all under users, but with_items: users.alice does not work.
Thanks in advance for any help. The docs do not seem to cover this and I've
Googled Ansible arrays and dicts to the point where I'm not finding any new
pages.
--
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/8bdf438b-e0d0-4f79-8596-fca289e2b8cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.