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.

49 lines
1.5 KiB

  1. ---
  2. - name: Kubernetes Apps | Wait for kube-apiserver
  3. uri:
  4. url: "{{ kube_apiserver_endpoint }}/healthz"
  5. validate_certs: false
  6. client_cert: "{{ kube_apiserver_client_cert }}"
  7. client_key: "{{ kube_apiserver_client_key }}"
  8. register: result
  9. until: result.status == 200
  10. retries: 10
  11. delay: 6
  12. when: inventory_hostname == groups['kube_control_plane'][0]
  13. - name: Set role node label to empty list
  14. set_fact:
  15. role_node_labels: []
  16. - name: Node label for nvidia GPU nodes
  17. set_fact:
  18. role_node_labels: "{{ role_node_labels + ['nvidia.com/gpu=true'] }}"
  19. when:
  20. - nvidia_gpu_nodes is defined
  21. - nvidia_accelerator_enabled | bool
  22. - inventory_hostname in nvidia_gpu_nodes
  23. - name: Set inventory node label to empty list
  24. set_fact:
  25. inventory_node_labels: []
  26. - name: Populate inventory node label
  27. set_fact:
  28. inventory_node_labels: "{{ inventory_node_labels + ['%s=%s' | format(item.key, item.value)] }}"
  29. loop: "{{ node_labels | d({}) | dict2items }}"
  30. when:
  31. - node_labels is defined
  32. - node_labels is mapping
  33. - debug: # noqa name[missing]
  34. var: role_node_labels
  35. - debug: # noqa name[missing]
  36. var: inventory_node_labels
  37. - name: Set label to node
  38. command: >-
  39. {{ kubectl }} label node {% if kube_override_hostname %}{{ kube_override_hostname }}{% else %}{{ inventory_hostname }}{% endif %} {{ item }} --overwrite=true
  40. loop: "{{ role_node_labels + inventory_node_labels }}"
  41. delegate_to: "{{ groups['kube_control_plane'][0] }}"
  42. changed_when: false
  43. ...