The hosts(5) manpage clearly states that the first entry is the "canonical name", or FQDN (Fully-Qualified Domain Name): IP_address canonical_hostname [aliases...] By using the alias as a first entry, `hostname -f` does not return the correct domain which breaks all sorts of unrelated functionality (it has impact over email server configuration, for example).
This commit is contained in:
parent
9b773185c3
commit
c33e08c3fa
1 changed files with 1 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
|||
blockinfile:
|
||||
dest: /etc/hosts
|
||||
block: |-
|
||||
{% for item in (groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]))|unique -%}{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}{% if (item != hostvars[item]['ansible_hostname']) %} {{ hostvars[item]['ansible_hostname'] }} {{ hostvars[item]['ansible_hostname'] }}.{{ dns_domain }}{% endif %} {{ item }} {{ item }}.{{ dns_domain }}
|
||||
{% for item in (groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]))|unique -%}{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}{% if (item != hostvars[item]['ansible_hostname']) %} {{ hostvars[item]['ansible_hostname'] }}.{{ dns_domain }} {{ hostvars[item]['ansible_hostname'] }}{% endif %} {{ item }} {{ item }}.{{ dns_domain }}
|
||||
{% endfor %}
|
||||
state: present
|
||||
create: yes
|
||||
|
|
Loading…
Reference in a new issue