commit
5253153dbb
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- hosts: all
|
||||||
|
gather_facts: true
|
||||||
|
|
||||||
|
- hosts: etcd:k8s-cluster:vault:calico-rr
|
||||||
|
vars_prompt:
|
||||||
|
name: "delete_nodes_confirmation"
|
||||||
|
prompt: "Are you sure you want to delete nodes state? Type 'yes' to delete nodes."
|
||||||
|
default: "no"
|
||||||
|
private: no
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: check confirmation
|
||||||
|
fail:
|
||||||
|
msg: "Delete nodes confirmation failed"
|
||||||
|
when: delete_nodes_confirmation != "yes"
|
||||||
|
|
||||||
|
- hosts: kube-master
|
||||||
|
roles:
|
||||||
|
- { role: remove-node/pre-remove, tags: pre-remove }
|
||||||
|
|
||||||
|
- hosts: kube-node
|
||||||
|
roles:
|
||||||
|
- { role: reset, tags: reset }
|
||||||
|
|
||||||
|
- hosts: kube-master
|
||||||
|
roles:
|
||||||
|
- { role: remove-node/post-remove, tags: post-remove }
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Delete node
|
||||||
|
command: kubectl delete node {{ item }}
|
||||||
|
with_items:
|
||||||
|
- "{{ groups['kube-node'] }}"
|
||||||
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||||
|
ignore_errors: yes
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
drain_grace_period: 300
|
||||||
|
drain_timeout: 360s
|
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: remove-node | Drain node except daemonsets resource
|
||||||
|
command: >-
|
||||||
|
{{ bin_dir }}/kubectl drain
|
||||||
|
--force
|
||||||
|
--ignore-daemonsets
|
||||||
|
--grace-period {{ drain_grace_period }}
|
||||||
|
--timeout {{ drain_timeout }}
|
||||||
|
--delete-local-data {{ item }}
|
||||||
|
with_items:
|
||||||
|
- "{{ groups['kube-node'] }}"
|
||||||
|
failed_when: false
|
||||||
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||||
|
ignore_errors: yes
|
Loading…
Reference in New Issue