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.

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