From bc1a4e12adb9f1009cd0796c9cd3ff2886533913 Mon Sep 17 00:00:00 2001
From: Spencer Smith <rsmitty@users.noreply.github.com>
Date: Thu, 16 Nov 2017 13:44:15 -0500
Subject: [PATCH] fix broken variable in ansible 2.4.1.0 and ensure tasks for
 calico-rr (#1982)

---
 cluster.yml                                | 6 +++---
 roles/network_plugin/calico/tasks/main.yml | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cluster.yml b/cluster.yml
index 0e014371e..995e36309 100644
--- a/cluster.yml
+++ b/cluster.yml
@@ -34,7 +34,7 @@
     - { role: download, tags: download, skip_downloads: false }
   environment: "{{proxy_env}}"
 
-- hosts: etcd:k8s-cluster:vault
+- hosts: etcd:k8s-cluster:vault:calico-rr
   any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
   roles:
     - { role: kubespray-defaults, when: "cert_management == 'vault'" }
@@ -47,13 +47,13 @@
     - { role: kubespray-defaults}
     - { role: etcd, tags: etcd, etcd_cluster_setup: true }
 
-- hosts: k8s-cluster
+- hosts: k8s-cluster:calico-rr
   any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
   roles:
     - { role: kubespray-defaults}
     - { role: etcd, tags: etcd, etcd_cluster_setup: false }
 
-- hosts: etcd:k8s-cluster:vault
+- hosts: etcd:k8s-cluster:vault:calico-rr
   any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
   roles:
     - { role: kubespray-defaults}
diff --git a/roles/network_plugin/calico/tasks/main.yml b/roles/network_plugin/calico/tasks/main.yml
index 7c8e247fc..15d793fdb 100644
--- a/roles/network_plugin/calico/tasks/main.yml
+++ b/roles/network_plugin/calico/tasks/main.yml
@@ -170,7 +170,7 @@
    "apiVersion": "v1",
    "metadata": {"node": "{{ inventory_hostname }}",
      "scope": "node",
-     "peerIP": "{{ hostvars[item]["calico_rr_ip"]|default(hostvars[item]["ip"])|default(hostvars[item]["ansible_default_ipv4.address"]) }}"}
+     "peerIP": "{{ hostvars[item]["calico_rr_ip"]|default(hostvars[item]["ip"])|default(hostvars[item]["ansible_default_ipv4"]["address"]) }}"}
    }'
    | {{ bin_dir }}/calicoctl create --skip-exists -f -
   with_items: "{{ groups['calico-rr'] | default([]) }}"
-- 
GitLab