I believe this should be:

"{{ hostvars[inventory_hostname]['ansible_' + iface].ipv4.address }}"

There are other variations too, but this should get you what you want.


On Thursday, December 12, 2013, Anand Buddhdev wrote:

> Hello ansible devs and users,
>
> In a variables file, I'd like to do something like this:
>
> iface: eth0
> address:"{{ ansible_{{ iface }}.ipv4.address }}"
>
> However, this does not work. In a task or template, instead of getting the
> IPv4 address of eth0, the "address" variable ends up being just "{{
> ansible_{{ iface }}.ipv4.address }}".
>
> Is there any way to achieve what I want to do?
>
> Regards,
>
> Anand
>
> --
> 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] <javascript:_e({},
> 'cvml', 'ansible-project%[email protected]');>.
> For more options, visit https://groups.google.com/groups/opt_out.
>


-- 
Matt Martz
[email protected]
http://sivel.net/

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to