2018-03-05 07:02:47 +00:00
|
|
|
---
|
2020-04-22 20:33:44 +00:00
|
|
|
- name: Check ansible version
|
|
|
|
import_playbook: ansible_version.yml
|
2018-03-05 07:02:47 +00:00
|
|
|
|
2021-04-29 12:20:50 +00:00
|
|
|
- name: Ensure compatibility with old groups
|
|
|
|
import_playbook: legacy_groups.yml
|
2021-03-24 00:26:05 +00:00
|
|
|
|
2022-02-05 07:50:50 +00:00
|
|
|
- hosts: bastion[0]
|
|
|
|
gather_facts: False
|
|
|
|
environment: "{{ proxy_disable_env }}"
|
|
|
|
roles:
|
|
|
|
- { role: kubespray-defaults }
|
|
|
|
- { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
|
|
|
|
|
2021-04-29 12:20:50 +00:00
|
|
|
- hosts: "{{ node | default('etcd:k8s_cluster:calico_rr') }}"
|
2019-08-07 11:46:50 +00:00
|
|
|
gather_facts: no
|
2021-06-07 12:02:40 +00:00
|
|
|
tasks:
|
|
|
|
- name: Confirm Execution
|
|
|
|
pause:
|
|
|
|
prompt: "Are you sure you want to delete nodes state? Type 'yes' to delete nodes."
|
|
|
|
register: pause_result
|
|
|
|
run_once: True
|
|
|
|
when:
|
|
|
|
- not (skip_confirmation | default(false) | bool)
|
2018-03-05 07:02:47 +00:00
|
|
|
|
2021-06-07 12:02:40 +00:00
|
|
|
- name: Fail if user does not confirm deletion
|
2018-03-05 07:02:47 +00:00
|
|
|
fail:
|
|
|
|
msg: "Delete nodes confirmation failed"
|
2021-06-07 12:02:40 +00:00
|
|
|
when: pause_result.user_input | default('yes') != 'yes'
|
2018-03-05 07:02:47 +00:00
|
|
|
|
2021-11-29 09:01:22 +00:00
|
|
|
- name: Gather facts
|
|
|
|
import_playbook: facts.yml
|
|
|
|
|
2021-04-29 12:20:50 +00:00
|
|
|
- hosts: "{{ node | default('kube_node') }}"
|
2020-04-17 23:23:36 +00:00
|
|
|
gather_facts: no
|
2021-02-23 17:44:02 +00:00
|
|
|
environment: "{{ proxy_disable_env }}"
|
2018-03-05 07:02:47 +00:00
|
|
|
roles:
|
2020-09-17 09:45:05 +00:00
|
|
|
- { role: kubespray-defaults, when: reset_nodes|default(True)|bool }
|
2022-01-04 15:10:53 +00:00
|
|
|
- { role: remove-node/pre-remove, tags: pre-remove }
|
2020-09-17 09:45:05 +00:00
|
|
|
- { role: remove-node/remove-etcd-node }
|
|
|
|
- { role: reset, tags: reset, when: reset_nodes|default(True)|bool }
|
2018-03-05 07:02:47 +00:00
|
|
|
|
2019-08-07 11:46:50 +00:00
|
|
|
# Currently cannot remove first master or etcd
|
2021-03-24 00:26:05 +00:00
|
|
|
- hosts: "{{ node | default('kube_control_plane[1:]:etcd[1:]') }}"
|
2020-04-17 23:23:36 +00:00
|
|
|
gather_facts: no
|
2021-02-23 17:44:02 +00:00
|
|
|
environment: "{{ proxy_disable_env }}"
|
2018-03-05 07:02:47 +00:00
|
|
|
roles:
|
2020-09-17 09:45:05 +00:00
|
|
|
- { role: kubespray-defaults, when: reset_nodes|default(True)|bool }
|
2018-03-05 07:02:47 +00:00
|
|
|
- { role: remove-node/post-remove, tags: post-remove }
|