task to add entries to hosts file

This commit is contained in:
Robert Kaussow 2018-12-01 04:06:08 +01:00
parent b16a0ce3e3
commit 2de5260253
2 changed files with 9 additions and 1 deletions

View File

@ -5,3 +5,8 @@ network_defaultif: eth0
network_disable_ipv6: false
network_dns_server: 8.8.8.8
network_interfaces: {}
network_hosts_entries: []
# network_hosts_entries:
# - hostname: myhost
# fqdn: myhost.rknet.org
# address: 1.2.3.4

View File

@ -1,4 +1,4 @@
#jinja2: trim_blocks: True, lstrip_blocks: True
#jinja2: lstrip_blocks: True
# {{ ansible_managed }}
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
{% if network_disable_ipv6 == false %}
@ -7,3 +7,6 @@
{% if network_hostname is defined and network_fqdn is defined and network_interfaces[network_defaultif].ipaddr is defined %}
{{ network_interfaces[network_defaultif].ipaddr }} {{ network_fqdn }} {{ network_hostname }}
{% endif %}
{% for item in network_hosts_entries %}
{{ item.address }} {{ item.fqdn }} {{ item.hostname }}
{% endfor %}