E.g:
group_vars/chocolate includes:
sauces:
-name : chocolate
value: yummy
group_vars/strawberry includes:
sauces:
-name : strawberry
value: more_yummy
So that in some task I can use sauces to iterate over both?
Using ansible 1.6.0
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8e2f97b3-b127-483d-bc70-ed9421299cb7%40googlegroups.com.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why I want to this:
I have several kinds of web site definitions and in production they live on separate nodes. However in dev/test I want the same node to host them on and I want to use the combined list in a with_nested. But I can quite easily think of many other applications for this. I just want to be sure it's not supported at the moment and if there's a reason I shouldn't be trying to do it like this.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3cc833cf-97f3-4fb5-8ab2-db9090dcf29a%40googlegroups.com.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3cc833cf-97f3-4fb5-8ab2-db9090dcf29a%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAEhzMJDvvNr9kRn3mXyGYJxZGZixrqn08zLofAX-8uW277Ut9A%40mail.gmail.com.
Apologies for the duplicate post in the first instance, Michael
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) }}"
Serge van Ginderachter's suggestion is the only one I've tried that meets my requirement and it's not ideal as he admits himself.
I thought stacking variables like this would make sense; I can see quite a few uses for it in a hierarchical inventory structure, but the fact that no one has requested it as a feature suggests to me I'm approaching group_vars in the wrong way; I'm coming to it from using hiera in puppet.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/099a7d14-1d02-4686-b1db-f2fedb46459a%40googlegroups.com.
dummy : []
vhosts : "{{ dummy|union(ext_hosts)etc...
Thanks again everyone for your help.
Consider the examples of packages or iptables or sudoers permissions. Lists are the obvious way to express these. So:
You have a base role for your organisation specifying common requirements. In addition you have specific requirements for particular roles. Moreover, in some circumstances, you might want nodes to be multi-roled.
The ability to append to lists in the way I've described frees you from having to consider, a priori, which set of these requirements a given task will have to address. The tasks can concentrate simply on applying the requirements, leaving the user free to define them in whatever (possibly dumb) way they see fit.
This is constructive feedback; I really like the product and will choose it over puppet every time from now given the choice.