2019-12-09 17:43:09 +08:00
|
|
|
---
|
|
|
|
- name: Kubernetes Apps | Wait for kube-apiserver
|
|
|
|
uri:
|
|
|
|
url: "{{ kube_apiserver_endpoint }}/healthz"
|
|
|
|
validate_certs: no
|
|
|
|
client_cert: "{{ kube_apiserver_client_cert }}"
|
|
|
|
client_key: "{{ kube_apiserver_client_key }}"
|
|
|
|
register: result
|
|
|
|
until: result.status == 200
|
|
|
|
retries: 10
|
|
|
|
delay: 6
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2019-12-09 17:43:09 +08:00
|
|
|
|
|
|
|
- name: Set role node label to empty list
|
|
|
|
set_fact:
|
|
|
|
role_node_labels: []
|
|
|
|
|
|
|
|
- name: Node label for nvidia GPU nodes
|
|
|
|
set_fact:
|
2023-07-05 11:36:54 +08:00
|
|
|
role_node_labels: "{{ role_node_labels + ['nvidia.com/gpu=true'] }}"
|
2019-12-09 17:43:09 +08:00
|
|
|
when:
|
|
|
|
- nvidia_gpu_nodes is defined
|
2023-07-05 11:36:54 +08:00
|
|
|
- nvidia_accelerator_enabled | bool
|
2019-12-09 17:43:09 +08:00
|
|
|
- inventory_hostname in nvidia_gpu_nodes
|
|
|
|
|
|
|
|
- name: Set inventory node label to empty list
|
|
|
|
set_fact:
|
|
|
|
inventory_node_labels: []
|
|
|
|
|
|
|
|
- name: Populate inventory node label
|
|
|
|
set_fact:
|
2023-07-05 11:36:54 +08:00
|
|
|
inventory_node_labels: "{{ inventory_node_labels + ['%s=%s' | format(item.key, item.value)] }}"
|
|
|
|
loop: "{{ node_labels | d({}) | dict2items }}"
|
2019-12-09 17:43:09 +08:00
|
|
|
when:
|
|
|
|
- node_labels is defined
|
|
|
|
- node_labels is mapping
|
|
|
|
|
2023-06-30 17:51:57 +08:00
|
|
|
- debug: # noqa name[missing]
|
2021-07-12 15:00:47 +08:00
|
|
|
var: role_node_labels
|
2023-06-30 17:51:57 +08:00
|
|
|
- debug: # noqa name[missing]
|
2021-07-12 15:00:47 +08:00
|
|
|
var: inventory_node_labels
|
2019-12-09 17:43:09 +08:00
|
|
|
|
|
|
|
- name: Set label to node
|
|
|
|
command: >-
|
2024-06-25 21:35:40 +08:00
|
|
|
{{ kubectl }} label node {% if kube_override_hostname %}{{ kube_override_hostname }}{% else %}{{ inventory_hostname }}{% endif %} {{ item }} --overwrite=true
|
2019-12-09 17:43:09 +08:00
|
|
|
loop: "{{ role_node_labels + inventory_node_labels }}"
|
2021-03-24 08:26:05 +08:00
|
|
|
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
2019-12-09 17:43:09 +08:00
|
|
|
changed_when: false
|
|
|
|
...
|