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.

47 lines
1.6 KiB

  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. - name: Gather calico facts
  8. tags:
  9. - facts
  10. when: calico_cni_config_slurp.content is defined
  11. block:
  12. - name: Set fact calico_cni_config from slurped CNI config
  13. set_fact:
  14. calico_cni_config: "{{ calico_cni_config_slurp['content'] | b64decode | from_json }}"
  15. - name: Set fact calico_datastore to etcd if needed
  16. set_fact:
  17. calico_datastore: etcd
  18. when:
  19. - "'plugins' in calico_cni_config"
  20. - "'etcd_endpoints' in calico_cni_config.plugins.0"
  21. - name: Calico | Get kubelet hostname
  22. shell: >-
  23. set -o pipefail && {{ kubectl }} get node -o custom-columns='NAME:.metadata.name,INTERNAL-IP:.status.addresses[?(@.type=="InternalIP")].address'
  24. | egrep "{{ ansible_all_ipv4_addresses | join('$|') }}$" | cut -d" " -f1
  25. args:
  26. executable: /bin/bash
  27. register: calico_kubelet_name
  28. delegate_to: "{{ groups['kube_control_plane'][0] }}"
  29. when:
  30. - "cloud_provider is defined"
  31. - name: Calico | Gather os specific variables
  32. include_vars: "{{ item }}"
  33. with_first_found:
  34. - files:
  35. - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower | replace('/', '_') }}.yml"
  36. - "{{ ansible_distribution | lower }}-{{ ansible_distribution_release }}.yml"
  37. - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower | replace('/', '_') }}.yml"
  38. - "{{ ansible_distribution | lower }}.yml"
  39. - "{{ ansible_os_family | lower }}-{{ ansible_architecture }}.yml"
  40. - "{{ ansible_os_family | lower }}.yml"
  41. - defaults.yml
  42. paths:
  43. - ../vars
  44. skip: true