This is what I wanted: https://github.com/ansible/ansible/issues/196 So
the resulting template code was:
hosts={% for k,v in hostvars.iteritems()
%}{{v['ansible_default_ipv4']['address']}},{% endfor %}
On Friday, September 5, 2014 5:35:56 PM UTC-4, Matt Hughes wrote:
>
> As far as I understand it, fact variables are exposed for the *current*
> server that Ansible is operating on. So if I say: {{
> ansible_default_ipv4.address }}, that is going to get evaluated for each
> host as I perform some operation using that variable.
>
> I want that same variable, but for all hosts in the current play. Say I
> had three hosts I was operating against:
>
> one: 98.0.0.1
> two: 98.0.0.2
> three: 98.0.0.3
>
> I want to be able to do something like:
>
> hosts={% for fact in facts %}
> {{ fact['ansible_default_ipv4.address'] }},
> {% endfor %}
>
> and have that evaluated to "98.0.0.1,98.0.0.2,98.0.0.3"
>
>
>
>
--
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/91fc61c2-05c0-49f8-8512-1c0b197d6831%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.