Hi,
having a jinja loop
{% for host in groups[‘server_group’] %} --dns={{ hostvars[host][‘ansible_eth0’][‘ipv4’][‘address’] }} {% endfor %}
i want to change “eth0” with a group_var as the interface some times differs. I know i could do a “ansible_eth1” in the template but i had to do this in a lot of places so i thought using group_var (interface) would be ok.
I tried {% for host in groups[‘server_group’] %} --dns={{ hostvars[host][‘ansible_{{interface}}’][‘ipv4’][‘address’] }} {% endfor %}
and a lot of other but always ended with a error. How can i use a group_var inside of this loop?
Cheers,
Mike