fix: simplify ipaddr mapping in hosts file
This commit is contained in:
parent
ead0fa501a
commit
8fe311094a
@ -6,7 +6,6 @@ network_reboot_enabled: True
|
|||||||
network_restart_enabled: True
|
network_restart_enabled: True
|
||||||
network_ipv6_enabled: True
|
network_ipv6_enabled: True
|
||||||
|
|
||||||
network_defaultif: eth0
|
|
||||||
network_interfaces: {}
|
network_interfaces: {}
|
||||||
# @var network_interfaces:example: >
|
# @var network_interfaces:example: >
|
||||||
# network_interfaces:
|
# network_interfaces:
|
||||||
|
@ -4,8 +4,11 @@
|
|||||||
{% if network_ipv6_enabled %}
|
{% if network_ipv6_enabled %}
|
||||||
::1 localhost6 localhost6.localdomain6
|
::1 localhost6 localhost6.localdomain6
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if network_hostname is defined and network_fqdn is defined and network_defaultif is defined %}
|
{% if network_hostname is defined and network_fqdn is defined %}
|
||||||
{{ network_interfaces[network_defaultif].ipaddr | default(hostvars[inventory_hostname]["ansible_" + network_defaultif].ipv4.address) }} {{ network_fqdn }} {{ network_hostname }}
|
{{ network_interfaces.0.ipaddr | default(ansible_default_ipv4.address) }} {{ network_fqdn }} {{ network_hostname }}
|
||||||
|
{% if network_ipv6_enabled %}
|
||||||
|
{{ network_interfaces.0.ipv6addr | default(ansible_default_ipv6.address) }} {{ network_fqdn }} {{ network_hostname }}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if network_hosts_extra %}
|
{% if network_hosts_extra %}
|
||||||
{% for item in network_hosts_extra %}
|
{% for item in network_hosts_extra %}
|
||||||
|
Loading…
Reference in New Issue
Block a user