127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts {# Static entries for all nodes in the cluster or just this one if there is no cluster. #} {% for address in nodes | default([hostvars[inventory_hostname]]) | map(attribute='interfaces') | flatten | map(attribute='ip_addresses') | flatten | selectattr('dns_name') %} {{ address.address | ipaddr('address') }} {{ address.dns_name }} {{ address.dns_name | split('.') | first }} {% endfor %}