Hello!
Assume there is a general list of entities (for example: users), which looks like this:
- hosts: 127.0.0.1
gather_facts: false
vars:
- users:
- name: luto
realname: Michael Lutonsky
- name: sue
realname: Susan Smith
Now I've got multiple roles, which I'd like to use:
1. a role which creates unix users; Parameters: a list of users (attributes: name, home, comment, ...)
2. a role which creates a web presence for each user; Parameters: a list of vhosts (attributes: servername, docroot, ...)
Real-Life examples for this would be: https://github.com/willshersystems/ansible-users and https://github.com/jdauphant/ansible-role-nginx
So the array
[ { name: "luto", realname: "Michael Lutonsky" }, { name: "sue", ... } ]
needs to be converted to
[ { name: "luto", home: "/home/luto", comment: "Michael Lutonsky" }, ... ]
and
[ { servername: "luto.company.org", docroot: "/var/www/luto" }, ... ].
I've come across the following PR, which has a workaround at the very bottom: https://github.com/ansible/ansible/pull/8019 But this seems rather cumbersome and hacky to me.
So, what is the ansible-way of achieving this?
Regards and Thank You,
luto