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.

48 lines
1.6 KiB

  1. ---
  2. - name: Common tasks for every playbooks
  3. import_playbook: boilerplate.yml
  4. - name: Confirm node removal
  5. hosts: "{{ node | default('etcd:k8s_cluster:calico_rr') }}"
  6. gather_facts: false
  7. tasks:
  8. - name: Confirm Execution
  9. pause:
  10. prompt: "Are you sure you want to delete nodes state? Type 'yes' to delete nodes."
  11. register: pause_result
  12. run_once: true
  13. when:
  14. - not (skip_confirmation | default(false) | bool)
  15. - name: Fail if user does not confirm deletion
  16. fail:
  17. msg: "Delete nodes confirmation failed"
  18. when: pause_result.user_input | default('yes') != 'yes'
  19. - name: Gather facts
  20. import_playbook: facts.yml
  21. when: reset_nodes | default(True) | bool
  22. - name: Reset node
  23. hosts: "{{ node | default('kube_node') }}"
  24. gather_facts: false
  25. environment: "{{ proxy_disable_env }}"
  26. pre_tasks:
  27. - name: Gather information about installed services
  28. service_facts:
  29. when: reset_nodes | default(True) | bool
  30. roles:
  31. - { role: kubespray-defaults, when: reset_nodes | default(True) | bool }
  32. - { role: remove-node/pre-remove, tags: pre-remove }
  33. - role: remove-node/remove-etcd-node
  34. when: "'etcd' in group_names"
  35. - { role: reset, tags: reset, when: reset_nodes | default(True) | bool }
  36. # Currently cannot remove first control plane node or first etcd node
  37. - name: Post node removal
  38. hosts: "{{ node | default('kube_control_plane[1:]:etcd[1:]') }}"
  39. gather_facts: false
  40. environment: "{{ proxy_disable_env }}"
  41. roles:
  42. - { role: kubespray-defaults, when: reset_nodes | default(True) | bool }
  43. - { role: remove-node/post-remove, tags: post-remove }