Previous Entry Share Next Entry
Ansible: get non-default ipv6.address from global scope
romik_g
Set 'iface' to something meaningful for your case in host_vars or group_vars, e.g. 'em1' or 'eth1'. Here is how you get it in Jinja2 template:

{% for v6 in hostvars[host]['ansible_' + hostvars[host]['iface']].ipv6 %}
{% if v6.scope == 'global' %}
  {{ v6.address }} - is your global IPv6 address on that interface.
{% endif %}
{% endfor %}

?

Log in

No account? Create an account