Using Ansible 1.5.3
I'm having some trouble with a situation where I have a variable that I'd
like to use in a template that uses "hostvars" but the variable in question
is calculated from facts.
I have a template that looks like this:
{% for host in groups['uat4-webapp']|sort %}
BalancerMember ajp://{{ hostvars[host].webapp_ip }}:8009 loadfactor=20
{% endfor %}
The "webapp_ip" variable is calculated like this in a group_vars file:
webapp_ip: "{{ ansible_eth0.ipv4.address }}"
When I compile the template above, it ends up looking like this:
BalancerMember ajp://{{ ansible_eth0.ipv4.address }}:8009 loadfactor=20
When I expected it to look like this:
BalancerMember ajp://10.10.1.36:8009 loadfactor=20
The reason for this "webapp_ip" variable as opposed to using the facts
directly is because I need it set to different things in different places
(one group of hosts has it at ansible_eth0.ipv4.address, another at
ansible_bond0.ipv4.address, etc).
Is this something that should work, or should I be looking to accomplish
this a different way?
thanks!
matt
--
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/CAMfrScezCeuOOgmWLhRgKtmkgafV48PnGb3fzBC2x0R8t9f9zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.