I needed the same thing recently, and wrote an internal module that appends 
one list to another, similar to set_fact.

However, after I had done so I noticed the union filter for jinja templates:
http://docs.ansible.com/playbooks_variables.html#set-theory-filters

This means you could do probably do the following (assuming sauces is 
already defined somewhere as an empty list):

group_vars/chocolate includes:

sauces_add:

  -name : chocolate
   value: yummy

sauces: "{{ sauces | union(sauces_add) }}"

or you could even chain the merges:

sauces: "{{ sauces | union(sauces_chocolate) | union(sauces_strawberry) }}"

On Thursday, May 15, 2014 1:41:38 PM UTC+1, Martin Devlin wrote:
>
> Thanks everyone. I think what I was after was confirmation that appending 
> lists in this fashion wasn't supported and it seems it isn't. Maciej 
> Delmanowski's suggestion looks like a viable workaround though so I'll give 
> it a go.
>
> Apologies for the duplicate post in the first instance, Michael
>

 

-- 
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/a285c1a5-eebc-469c-9477-629c0cb87554%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to