ansible-role-network/templates/hosts.j2
2021-08-24 19:53:34 +02:00

12 lines
469 B
Django/Jinja

# {{ ansible_managed }}
127.0.0.1 localhost
{% set interface = (network_interfaces|dict2items|first)['value'] %}
{% if interface.dhcp is defined and interface.dhcp %}{{ ansible_default_ipv4.address }}{% else %}{{ interface.address }}{% endif %} {{ inventory_hostname }} {{ inventory_hostname_short }}
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
{% for host, ip in network_hosts.items() %}
{{ ip }} {{ host }}
{% endfor %}