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-03-24 00:26:05 +00:00
|
|
|
- name: Add kube-master nodes to kube_control_plane
|
|
|
|
# This is for old inventory which contains kube-master instead of kube_control_plane
|
|
|
|
hosts: kube-master
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
|
|
- name: add nodes to kube_control_plane group
|
|
|
|
group_by:
|
|
|
|
key: 'kube_control_plane'
|
|
|
|
|
2018-11-10 16:51:24 +00:00
|
|
|
- hosts: "{{ node | default('etcd:k8s-cluster:calico-rr') }}"
|
2019-08-07 11:46:50 +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
|
|
|
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"
|
|
|
|
|
2021-03-24 00:26:05 +00:00
|
|
|
- hosts: kube_control_plane[0]
|
2019-08-07 11:46:50 +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:
|
2019-07-05 10:28:34 +00:00
|
|
|
- { role: kubespray-defaults }
|
2020-08-05 08:52:28 +00:00
|
|
|
- { role: bootstrap-os, tags: bootstrap-os }
|
2018-03-05 07:02:47 +00:00
|
|
|
- { role: remove-node/pre-remove, tags: pre-remove }
|
|
|
|
|
2018-06-29 05:15:29 +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 }
|
|
|
|
- { role: bootstrap-os, tags: bootstrap-os, when: reset_nodes|default(True)|bool }
|
|
|
|
- { 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 }
|
|
|
|
- { role: bootstrap-os, tags: bootstrap-os, when: reset_nodes|default(True)|bool }
|
2018-03-05 07:02:47 +00:00
|
|
|
- { role: remove-node/post-remove, tags: post-remove }
|