From 059cd17b476e76072124fd3eb9cbf7d095790eb8 Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Fri, 31 Aug 2018 16:33:18 +0200 Subject: [PATCH] Fix target hosts generation when /etc/hosts does not contain 127.0.0.1 or ::1 --- 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 5141d531f..f7d3e6023 100644 --- a/roles/kubernetes/preinstall/tasks/0090-etchosts.yml +++ b/roles/kubernetes/preinstall/tasks/0090-etchosts.yml @@ -40,7 +40,7 @@ - name: Hosts | Update target hosts file entries dict with required entries set_fact: etc_hosts_localhosts_dict_target: >- - {%- set target_entries = etc_hosts_localhosts_dict.get(item.key, []) | difference(item.value.get('unexpected' ,[])) -%} + {%- set target_entries = (etc_hosts_localhosts_dict|default({})).get(item.key, []) | difference(item.value.get('unexpected' ,[])) -%} {{ etc_hosts_localhosts_dict_target|default({}) | combine({item.key: (target_entries + item.value.expected)|unique}) }} with_dict: "{{ etc_hosts_localhost_entries }}"