I may have some of the exact syntax wrong, I haven't as much with
templates, but the following should be close.
group_vars/all:
==
spring: ['a', 'b', 'c']
spring:
- a
- b
- c
==
main.xml.j2:
==
{% for resource in spring %}
<spring:import resource="{{ resource }}.xml"/>
{% endfor %}
==
On 02/14/2014 09:02 AM, jepper wrote:
This is a bit over my head, so I'm going to ask.
I have several environments, with many variables defined using
group_vars, e.g.
test1/group_vars/all
test2/group_vars/all
I have mule in each environment, and I need to tailor a file which tells
must what libraries to load. We can it main.xml, one for each
environment. Different teams should be able to include or exclude the
libraries they wish to work with.
So I can't have a global or completely static main.xml.j2 template. I do
now, and I only replace a hostname, but this will not suffice.
I have to construct main.xml.
test1: main.xml might have
<spring:beans>
<spring:import resource="a.xml"/>
<spring:import resource="b.xml"/>
<spring:import resource="c.xml"/>
<spring:import resource="d.xml"/>
<spring:import resource="e.xml"/>
</spring:beans>
while test2 main.xml might have
<spring:beans>
<spring:import resource="a.xml"/>
<spring:import resource="b.xml"/>
<spring:import resource="c.xml"/>
</spring:beans>
In group_vars/all for each environment, I want
test1/group_vars/all
spring: a,b,c,d,e
test2/group_vars/all
spring: a,b,c
How should I construct my template file for this to work?
--
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.