From ab4eb809d41572c679bea9d468348d05af7483e6 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Thu, 15 Dec 2016 12:27:03 +0400 Subject: [PATCH] Add dns_domain for each host to /etc/hosts Fixes #754 --- roles/kubernetes/preinstall/tasks/etchosts.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/kubernetes/preinstall/tasks/etchosts.yml b/roles/kubernetes/preinstall/tasks/etchosts.yml index 5c5e1a45f..43952389a 100644 --- a/roles/kubernetes/preinstall/tasks/etchosts.yml +++ b/roles/kubernetes/preinstall/tasks/etchosts.yml @@ -3,8 +3,7 @@ blockinfile: dest: /etc/hosts block: |- - {% for item in groups['all'] -%} - {{ 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'] }}{% endif %} {{ item }} + {% for item in groups['all'] -%}{{ 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 }} {% endfor %} state: present create: yes