On 22. mai 2017 19:01, Adam Lininger wrote:
> I would like to be able to edit a variable (per host) that was originally
> defined in a default file.
You can overwrite variables per host, but not edit or partial overwrite a variable.
What you could do is introduce a list variable called enabled_users.
Then you can list all the user that you would like to create on a host, and the role has all the users.
If you need to overwrite some of the values you could do something like list_of_user_overwrite.
- user:
name: "{{ list_of_user_overwrite[item.username] | default(item.username) }}"
state: "{{ list_of_user_overwrite[item.state] | default(item.state) }}"
...
...
when: item.username in enabled_users
with_items: "{{ list_of_users }}"
--
Kai Stian Olstad