From f34d953d64250d568208f8904a28a31999ca6822 Mon Sep 17 00:00:00 2001 From: Brad Beam Date: Wed, 24 May 2017 18:14:28 +0000 Subject: [PATCH] Consolidate calico-rr address lookup ( uses rr_ip fact ) --- cluster.yml | 12 ++++++------ roles/network_plugin/calico/tasks/main.yml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cluster.yml b/cluster.yml index bdaced1ae..64535a5a0 100644 --- a/cluster.yml +++ b/cluster.yml @@ -57,6 +57,12 @@ - { role: kargo-defaults} - { role: vault, tags: vault, when: "cert_management == 'vault'"} +- hosts: calico-rr + any_errors_fatal: "{{ any_errors_fatal | default(true) }}" + roles: + - { role: kargo-defaults} + - { role: network_plugin/calico/rr, tags: network } + - hosts: k8s-cluster any_errors_fatal: "{{ any_errors_fatal | default(true) }}" roles: @@ -72,12 +78,6 @@ - { role: kubernetes-apps/network_plugin, tags: network } - { role: kubernetes-apps/policy_controller, tags: policy-controller } -- hosts: calico-rr - any_errors_fatal: "{{ any_errors_fatal | default(true) }}" - roles: - - { role: kargo-defaults} - - { role: network_plugin/calico/rr, tags: network } - - hosts: k8s-cluster any_errors_fatal: "{{ any_errors_fatal | default(true) }}" roles: diff --git a/roles/network_plugin/calico/tasks/main.yml b/roles/network_plugin/calico/tasks/main.yml index 06c987b57..b9f8fb22d 100644 --- a/roles/network_plugin/calico/tasks/main.yml +++ b/roles/network_plugin/calico/tasks/main.yml @@ -233,7 +233,7 @@ "metadata": { "node": "{{ inventory_hostname.split(".")[0] }}", "scope": "node", - "peerIP": "{{ hostvars[item]["calico_rr_ip"] | default(hostvars[item]["ip"]) | default(hostvars[item]["ansible_default_ipv4"]["address"]) }}" + "peerIP": "{{ hostvars[item]["rr_ip"] }}" } }' | {{ bin_dir }}/calicoctl create --skip-exists -f - @@ -256,7 +256,7 @@ peer_with_router|default(false) and inventory_hostname in groups['k8s-cluster']) - name: Calico (old) | Configure peering with route reflectors - shell: "{{ bin_dir }}/calicoctl node bgp peer add {{ hostvars[item]['calico_rr_ip'] | default(hostvars[item]['ip']) | default(hostvars[item]['ansible_default_ipv4']['address']) }} as {{ local_as | default(global_as_num) }}" + shell: "{{ bin_dir }}/calicoctl node bgp peer add {{ hostvars[item]['rr_ip'] }} as {{ local_as | default(global_as_num) }}" with_items: "{{ groups['calico-rr'] | default([]) }}" when: (legacy_calicoctl and peer_with_calico_rr|default(false) and inventory_hostname in groups['k8s-cluster']