From c33e08c3fa304861e3d934d5811950c3486c7055 Mon Sep 17 00:00:00 2001 From: anarcat Date: Tue, 16 Oct 2018 06:55:55 -0400 Subject: [PATCH] show FQDN first in /etc/hosts (closes: #3521) (#3522) 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). --- roles/kubernetes/preinstall/tasks/0090-etchosts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kubernetes/preinstall/tasks/0090-etchosts.yml b/roles/kubernetes/preinstall/tasks/0090-etchosts.yml index d15787e76..405c885f0 100644 --- a/roles/kubernetes/preinstall/tasks/0090-etchosts.yml +++ b/roles/kubernetes/preinstall/tasks/0090-etchosts.yml @@ -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