servers/templates/hosts.j2
Timotej Lazar e754db5fbd Consolidate hosts template
For alpine, debian, ceph and proxmox roles.

Add the union of IPv6 LL host entries across all distros to make sure nothing croaks.
2025-04-10 18:22:41 +02:00

16 lines
573 B
Django/Jinja

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 %}