2018-08-23 14:17:18 +00:00
|
|
|
---
|
2020-09-23 15:38:09 +00:00
|
|
|
- name: Slurp CNI config
|
|
|
|
slurp:
|
|
|
|
src: /etc/cni/net.d/10-calico.conflist
|
|
|
|
register: calico_cni_config_slurp
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Set fact calico_cni_config from slurped CNI config
|
|
|
|
set_fact:
|
|
|
|
calico_cni_config: "{{ calico_cni_config_slurp['content'] | b64decode | from_json }}"
|
|
|
|
- name: Set fact calico_datastore to etcd if needed
|
|
|
|
set_fact:
|
|
|
|
calico_datastore: etcd
|
2021-09-27 18:04:20 +00:00
|
|
|
when:
|
|
|
|
- "'plugins' in calico_cni_config"
|
|
|
|
- "'etcd_endpoints' in calico_cni_config.plugins.0"
|
2020-09-23 15:38:09 +00:00
|
|
|
when: calico_cni_config_slurp.content is defined
|
|
|
|
|
2020-09-03 06:55:40 +00:00
|
|
|
- name: Calico | Get kubelet hostname
|
2018-08-23 14:17:18 +00:00
|
|
|
shell: >-
|
2020-09-03 06:55:40 +00:00
|
|
|
set -o pipefail && {{ bin_dir }}/kubectl get node -o custom-columns='NAME:.metadata.name,INTERNAL-IP:.status.addresses[?(@.type=="InternalIP")].address'
|
2018-08-23 14:17:18 +00:00
|
|
|
| egrep "{{ ansible_all_ipv4_addresses | join('$|') }}$" | cut -d" " -f1
|
2020-09-03 06:55:40 +00:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2018-08-23 14:17:18 +00:00
|
|
|
register: calico_kubelet_name
|
2021-03-24 00:26:05 +00:00
|
|
|
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
2018-08-23 14:17:18 +00:00
|
|
|
when:
|
2020-09-23 15:38:09 +00:00
|
|
|
- "cloud_provider is defined"
|
2021-06-25 10:22:45 +00:00
|
|
|
|
|
|
|
- name: Calico | Gather os specific variables
|
|
|
|
include_vars: "{{ item }}"
|
|
|
|
with_first_found:
|
|
|
|
- files:
|
|
|
|
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_version|lower|replace('/', '_') }}.yml"
|
|
|
|
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_release }}.yml"
|
|
|
|
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml"
|
|
|
|
- "{{ ansible_distribution|lower }}.yml"
|
|
|
|
- "{{ ansible_os_family|lower }}-{{ ansible_architecture }}.yml"
|
|
|
|
- "{{ ansible_os_family|lower }}.yml"
|
|
|
|
- defaults.yml
|
|
|
|
paths:
|
|
|
|
- ../vars
|
|
|
|
skip: true
|
|
|
|
tags:
|
|
|
|
- facts
|