2018-03-05 07:02:47 +00:00
|
|
|
---
|
2020-07-27 13:24:17 +00:00
|
|
|
- name: cordon-node | Mark all nodes as unschedulable before drain # noqa 301
|
2019-05-22 06:36:05 +00:00
|
|
|
command: >-
|
2020-07-13 14:18:40 +00:00
|
|
|
{{ bin_dir }}/kubectl cordon {{ hostvars[item]['kube_override_hostname']|default(item) }}
|
2019-05-22 06:36:05 +00:00
|
|
|
with_items:
|
|
|
|
- "{{ node.split(',') | default(groups['kube-node']) }}"
|
2020-08-21 07:13:39 +00:00
|
|
|
failed_when: result.rc == 0 and not allow_ungraceful_removal
|
2019-05-22 06:36:05 +00:00
|
|
|
delegate_to: "{{ groups['kube-master']|first }}"
|
|
|
|
run_once: true
|
|
|
|
ignore_errors: yes
|
2018-03-05 07:02:47 +00:00
|
|
|
|
2020-07-27 13:24:17 +00:00
|
|
|
- name: remove-node | Drain node except daemonsets resource # noqa 301
|
2018-03-05 07:02:47 +00:00
|
|
|
command: >-
|
2018-12-06 10:33:38 +00:00
|
|
|
{{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf drain
|
2018-03-05 07:02:47 +00:00
|
|
|
--force
|
|
|
|
--ignore-daemonsets
|
|
|
|
--grace-period {{ drain_grace_period }}
|
|
|
|
--timeout {{ drain_timeout }}
|
2020-07-13 14:18:40 +00:00
|
|
|
--delete-local-data {{ hostvars[item]['kube_override_hostname']|default(item) }}
|
2018-03-05 07:02:47 +00:00
|
|
|
with_items:
|
2018-06-29 05:15:29 +00:00
|
|
|
- "{{ node.split(',') | default(groups['kube-node']) }}"
|
2020-08-21 07:13:39 +00:00
|
|
|
failed_when: result.rc == 0 and not allow_ungraceful_removal
|
2018-06-23 06:40:59 +00:00
|
|
|
delegate_to: "{{ groups['kube-master']|first }}"
|
|
|
|
run_once: true
|
2018-03-05 07:02:47 +00:00
|
|
|
ignore_errors: yes
|