2018-03-05 15:02:47 +08:00
|
|
|
---
|
2020-04-23 04:33:44 +08:00
|
|
|
- name: Check ansible version
|
|
|
|
import_playbook: ansible_version.yml
|
2018-03-05 15:02:47 +08:00
|
|
|
|
2020-09-17 17:46:45 +08:00
|
|
|
- hosts: all
|
|
|
|
gather_facts: false
|
|
|
|
tags: always
|
|
|
|
tasks:
|
|
|
|
- name: "Set up proxy environment"
|
|
|
|
set_fact:
|
|
|
|
proxy_env:
|
|
|
|
http_proxy: "{{ http_proxy | default ('') }}"
|
|
|
|
HTTP_PROXY: "{{ http_proxy | default ('') }}"
|
|
|
|
https_proxy: "{{ https_proxy | default ('') }}"
|
|
|
|
HTTPS_PROXY: "{{ https_proxy | default ('') }}"
|
|
|
|
no_proxy: "{{ no_proxy | default ('') }}"
|
|
|
|
NO_PROXY: "{{ no_proxy | default ('') }}"
|
|
|
|
no_log: true
|
|
|
|
|
2018-11-11 00:51:24 +08:00
|
|
|
- hosts: "{{ node | default('etcd:k8s-cluster:calico-rr') }}"
|
2019-08-07 19:46:50 +08:00
|
|
|
gather_facts: no
|
2018-03-05 15:02:47 +08: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"
|
|
|
|
|
|
|
|
- hosts: kube-master
|
2019-08-07 19:46:50 +08:00
|
|
|
gather_facts: no
|
2018-03-05 15:02:47 +08:00
|
|
|
roles:
|
2019-07-05 18:28:34 +08:00
|
|
|
- { role: kubespray-defaults }
|
2018-03-05 15:02:47 +08:00
|
|
|
- { role: remove-node/pre-remove, tags: pre-remove }
|
|
|
|
|
2020-04-18 07:23:36 +08:00
|
|
|
- name: Gather facts
|
|
|
|
import_playbook: facts.yml
|
|
|
|
|
2018-06-29 13:15:29 +08:00
|
|
|
- hosts: "{{ node | default('kube-node') }}"
|
2020-04-18 07:23:36 +08:00
|
|
|
gather_facts: no
|
2018-03-05 15:02:47 +08:00
|
|
|
roles:
|
2018-05-10 12:40:59 +08:00
|
|
|
- { role: kubespray-defaults }
|
2019-08-07 19:46:50 +08:00
|
|
|
- { role: reset, tags: reset, when: reset_nodes|default(True) }
|
2018-03-05 15:02:47 +08:00
|
|
|
|
2019-08-07 19:46:50 +08:00
|
|
|
# Currently cannot remove first master or etcd
|
|
|
|
- hosts: "{{ node | default('kube-master[1:]:etcd[:1]') }}"
|
2020-04-18 07:23:36 +08:00
|
|
|
gather_facts: no
|
2018-03-05 15:02:47 +08:00
|
|
|
roles:
|
2019-07-05 18:28:34 +08:00
|
|
|
- { role: kubespray-defaults }
|
2018-03-05 15:02:47 +08:00
|
|
|
- { role: remove-node/post-remove, tags: post-remove }
|