Consolidate calico-rr address lookup ( uses rr_ip fact )

This commit is contained in:
Brad Beam 2017-05-24 18:14:28 +00:00
parent 1fdde8f44b
commit f34d953d64
2 changed files with 8 additions and 8 deletions

View file

@ -57,6 +57,12 @@
- { role: kargo-defaults} - { role: kargo-defaults}
- { role: vault, tags: vault, when: "cert_management == 'vault'"} - { 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 - hosts: k8s-cluster
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
roles: roles:
@ -72,12 +78,6 @@
- { role: kubernetes-apps/network_plugin, tags: network } - { role: kubernetes-apps/network_plugin, tags: network }
- { role: kubernetes-apps/policy_controller, tags: policy-controller } - { 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 - hosts: k8s-cluster
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
roles: roles:

View file

@ -233,7 +233,7 @@
"metadata": { "metadata": {
"node": "{{ inventory_hostname.split(".")[0] }}", "node": "{{ inventory_hostname.split(".")[0] }}",
"scope": "node", "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 - | {{ bin_dir }}/calicoctl create --skip-exists -f -
@ -256,7 +256,7 @@
peer_with_router|default(false) and inventory_hostname in groups['k8s-cluster']) peer_with_router|default(false) and inventory_hostname in groups['k8s-cluster'])
- name: Calico (old) | Configure peering with route reflectors - 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([]) }}" with_items: "{{ groups['calico-rr'] | default([]) }}"
when: (legacy_calicoctl and when: (legacy_calicoctl and
peer_with_calico_rr|default(false) and inventory_hostname in groups['k8s-cluster'] peer_with_calico_rr|default(false) and inventory_hostname in groups['k8s-cluster']