ansible-role-network/templates/hosts.j2

13 lines
469 B
Text
Raw Normal View History

2021-08-24 17:40:28 +00:00
# {{ 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 %}