From eec2ed5809cf5874425573a8d4002a90022a3475 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Thu, 1 Dec 2016 15:37:59 -0800 Subject: [PATCH] Allow etcd_access_addresses to be more flexible The variale etcd_access_addresses is used to determine how to address communication from other roles to the etcd cluster. It was set to the address that ansible uses to connect to instance ({{ item }})s and not the the variable: ip_access which had already been created and could already be overridden through the access_ip variable. This change allows ansible to connect to a machine using a different address than the one used to access etcd. --- roles/kubernetes/preinstall/tasks/set_facts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kubernetes/preinstall/tasks/set_facts.yml b/roles/kubernetes/preinstall/tasks/set_facts.yml index d85f0f722..bd0d68aff 100644 --- a/roles/kubernetes/preinstall/tasks/set_facts.yml +++ b/roles/kubernetes/preinstall/tasks/set_facts.yml @@ -30,7 +30,7 @@ - set_fact: etcd_access_addresses: |- {% for item in groups['etcd'] -%} - https://{{ item }}:2379{% if not loop.last %},{% endif %} + https://{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}:2379{% if not loop.last %},{% endif %} {%- endfor %} - set_fact: etcd_access_endpoint="{% if etcd_multiaccess %}{{ etcd_access_addresses }}{% else %}{{ etcd_endpoint }}{% endif %}" - set_fact: