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.3 KiB

  1. ---
  2. - name: Kubernetes Apps | Wait for kube-apiserver
  3. uri:
  4. url: "{{ kube_apiserver_endpoint }}/healthz"
  5. validate_certs: no
  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-master'][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: var=role_node_labels
  34. - debug: var=inventory_node_labels
  35. - name: Set label to node
  36. command: >-
  37. {{ bin_dir }}/kubectl label node {{ inventory_hostname }} {{ item }} --overwrite=true
  38. loop: "{{ role_node_labels + inventory_node_labels }}"
  39. delegate_to: "{{ groups['kube-master'][0] }}"
  40. changed_when: false
  41. ...