2018-03-05 15:02:47 +08:00
|
|
|
---
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: Remove-node | Delete node
|
2023-07-05 11:36:54 +08:00
|
|
|
command: "{{ kubectl }} delete node {{ kube_override_hostname | default(inventory_hostname) }}"
|
|
|
|
delegate_to: "{{ groups['kube_control_plane'] | first }}"
|
2023-01-03 21:03:32 +08:00
|
|
|
when:
|
|
|
|
- groups['kube_control_plane'] | length > 0
|
|
|
|
# ignore servers that are not nodes
|
2023-07-05 11:36:54 +08:00
|
|
|
- inventory_hostname in groups['k8s_cluster'] and kube_override_hostname | default(inventory_hostname) in nodes.stdout_lines
|
2022-07-27 01:51:09 +08:00
|
|
|
retries: "{{ delete_node_retries }}"
|
2021-11-08 18:22:58 +08:00
|
|
|
# Sometimes the api-server can have a short window of indisponibility when we delete a master node
|
2022-07-27 01:51:09 +08:00
|
|
|
delay: "{{ delete_node_delay_seconds }}"
|
2021-11-08 18:22:58 +08:00
|
|
|
register: result
|
|
|
|
until: result is not failed
|