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.

43 lines
1.4 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: no
  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: no
  25. environment: "{{ proxy_disable_env }}"
  26. roles:
  27. - { role: kubespray-defaults, when: reset_nodes | default(True) | bool }
  28. - { role: remove-node/pre-remove, tags: pre-remove }
  29. - { role: remove-node/remove-etcd-node }
  30. - { role: reset, tags: reset, when: reset_nodes | default(True) | bool }
  31. # Currently cannot remove first master or etcd
  32. - name: Post node removal
  33. hosts: "{{ node | default('kube_control_plane[1:]:etcd[1:]') }}"
  34. gather_facts: no
  35. environment: "{{ proxy_disable_env }}"
  36. roles:
  37. - { role: kubespray-defaults, when: reset_nodes | default(True) | bool }
  38. - { role: remove-node/post-remove, tags: post-remove }