Эх сурвалжийг харах

Make possible to get more ganularity while adding /etc/hosts entries

Emmanuel Bouthenot 9 жил өмнө
parent
commit
f21541b453

+ 3 - 0
roles/common/defaults/main.yml

@@ -12,6 +12,9 @@ locale: 'en_US.UTF-8'
 timezone_area: 'Europe'
 timezone_city: 'Paris'
 
+hosts_fqdn: True
+hosts_static_lookup: Null
+
 debian_mirror: 'ftp://ftp.fr.debian.org/debian'
 
 apt_keys: Null

+ 7 - 2
roles/common/templates/hosts.j2

@@ -4,12 +4,17 @@
 {% endif -%}
 
 127.0.0.1 localhost.localdomain localhost
-{% if ansible_default_ipv4.address is defined %}
+{% if hosts_fqdn and ansible_default_ipv4.address is defined %}
 {{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}
 {% endif %}
-{% if ansible_default_ipv6.address is defined %}
+{% if hosts_fqdn and ansible_default_ipv6.address is defined %}
 {{ ansible_default_ipv6.address }} {{ ansible_fqdn }} {{ ansible_hostname }}
 {% endif %}
+{% if hosts_static_lookup %}
+{% for h in hosts_static_lookup %}
+{{ h }}
+{% endfor %}
+{%endif %}
 
 # The following lines are desirable for IPv6 capable hosts
 ::1             localhost       ip6-localhost   ip6-loopback