ansible / ipv6 addresses / without link local

ansible / ipv6 addresses / without link local

  • Written by
    Walter Doekes
  • Published on

Trying to get the IPv6 addresses as ansible fact, but getting unwanted link_local scope addresses?

Maybe you're landing here because you did not see a solution at “all_ipv6_addresses includes link local addresses”. (I find it most odd that they locked the GitHub ticket, eliminating the possibility for anyone to reply with a fix.)

The ansible_all_ipv6_addresses | reject("ansible.utils.in_network", "fe80::/10") construct works for me. For example:

local-address=127.0.0.1, ::1, {{ (
  ansible_all_ipv4_addresses + (
    ansible_all_ipv6_addresses|reject("ansible.utils.in_network","fe80::/10"))
  )|join(", ") }}

Back to overview Newer post: netplan / docker0 / bind on 172.17.0.1 Older post: zabbix server / jammy upgrade / missing font