Dick, something like this:
http://blog.crisp.se/2016/10/20/maxwenzin/how-to-append-to-lists-in-ansible
On Wednesday, November 1, 2017 at 4:45:27 PM UTC+5, Dick Visser wrote:
>
> Hi
>
> I have a few use cases where I define a list in group_vars/all.yml,
> for instance a list of users:
>
>
> users:
> - allen
> - bob
> - chris
> - dick
>
>
> So this list applies to all hosts in my case.
>
> But for a specific host, I want to add one entry to the list.
> The only way I can get that to work is by copying the list in
> host_vars/somehost/main.yml and just manually add it:
>
> users:
> - allen
> - bob
> - chris
> - dick
> - extrauser
>
> Obviously this is not ideal as any changes made to the first var will
> have to be manually carried over to the specific instances.
>
> Is there some way to append items to list vars (or subtract, for that
> matter)?
>
> I was hoping to be able to use something like:
>
> users: "{{ users }} + ['extrauser']"
>
> But that gives me "recursive loop detected in template string".
>
> Any other/clean ways to solve this?
>
>
> Thanks!!
>
>
> --
> Dick Visser
> GÉANT
>
> Want to join us? We're hiring: https://www.geant.org/jobs
>
--
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/938f2541-e78b-424c-8aab-bb40834a57fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.