You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
962 B

  1. ---
  2. - name: Slurp CNI config
  3. slurp:
  4. src: /etc/cni/net.d/10-calico.conflist
  5. register: calico_cni_config_slurp
  6. failed_when: false
  7. - block:
  8. - name: Set fact calico_cni_config from slurped CNI config
  9. set_fact:
  10. calico_cni_config: "{{ calico_cni_config_slurp['content'] | b64decode | from_json }}"
  11. - name: Set fact calico_datastore to etcd if needed
  12. set_fact:
  13. calico_datastore: etcd
  14. when: "'etcd_endpoints' in calico_cni_config.plugins.0"
  15. when: calico_cni_config_slurp.content is defined
  16. - name: Calico | Get kubelet hostname
  17. shell: >-
  18. set -o pipefail && {{ bin_dir }}/kubectl get node -o custom-columns='NAME:.metadata.name,INTERNAL-IP:.status.addresses[?(@.type=="InternalIP")].address'
  19. | egrep "{{ ansible_all_ipv4_addresses | join('$|') }}$" | cut -d" " -f1
  20. args:
  21. executable: /bin/bash
  22. register: calico_kubelet_name
  23. delegate_to: "{{ groups['kube-master'][0] }}"
  24. when:
  25. - "cloud_provider is defined"