kubernetesbare-metalk8s-sig-cluster-lifecycleawskubesprayhigh-availabilityansiblekubernetes-clustergce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.9 KiB
58 lines
1.9 KiB
---
|
|
- name: Validate nodes for removal
|
|
hosts: localhost
|
|
tasks:
|
|
- name: Assert that nodes are specified for removal
|
|
assert:
|
|
that:
|
|
- node is defined
|
|
- node | length > 0
|
|
msg: "No nodes specified for removal. The `node` variable must be set explicitly."
|
|
|
|
- name: Common tasks for every playbooks
|
|
import_playbook: boilerplate.yml
|
|
|
|
- name: Confirm node removal
|
|
hosts: "{{ node | default('this_is_unreachable') }}"
|
|
gather_facts: false
|
|
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)
|
|
|
|
- name: Fail if user does not confirm deletion
|
|
fail:
|
|
msg: "Delete nodes confirmation failed"
|
|
when: pause_result.user_input | default('yes') != 'yes'
|
|
|
|
- name: Gather facts
|
|
import_playbook: facts.yml
|
|
when: reset_nodes | default(True) | bool
|
|
|
|
- name: Reset node
|
|
hosts: "{{ node | default('this_is_unreachable') }}"
|
|
gather_facts: false
|
|
environment: "{{ proxy_disable_env }}"
|
|
pre_tasks:
|
|
- name: Gather information about installed services
|
|
service_facts:
|
|
when: reset_nodes | default(True) | bool
|
|
roles:
|
|
- { role: kubespray_defaults, when: reset_nodes | default(True) | bool }
|
|
- { role: remove_node/pre_remove, tags: pre-remove }
|
|
- role: remove-node/remove-etcd-node
|
|
when: "'etcd' in group_names"
|
|
- { role: reset, tags: reset, when: reset_nodes | default(True) | bool }
|
|
|
|
# Currently cannot remove first control plane node or first etcd node
|
|
- name: Post node removal
|
|
hosts: "{{ node | default('this_is_unreachable') }}"
|
|
gather_facts: false
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray_defaults, when: reset_nodes | default(True) | bool }
|
|
- { role: remove-node/post-remove, tags: post-remove }
|