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.

54 lines
1.7 KiB

  1. ---
  2. - name: Check ansible version
  3. import_playbook: ansible_version.yml
  4. - name: Ensure compatibility with old groups
  5. import_playbook: legacy_groups.yml
  6. - name: Install bastion ssh config
  7. hosts: bastion[0]
  8. gather_facts: False
  9. environment: "{{ proxy_disable_env }}"
  10. roles:
  11. - { role: kubespray-defaults }
  12. - { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
  13. - name: Confirm node removal
  14. hosts: "{{ node | default('etcd:k8s_cluster:calico_rr') }}"
  15. gather_facts: no
  16. tasks:
  17. - name: Confirm Execution
  18. pause:
  19. prompt: "Are you sure you want to delete nodes state? Type 'yes' to delete nodes."
  20. register: pause_result
  21. run_once: True
  22. when:
  23. - not (skip_confirmation | default(false) | bool)
  24. - name: Fail if user does not confirm deletion
  25. fail:
  26. msg: "Delete nodes confirmation failed"
  27. when: pause_result.user_input | default('yes') != 'yes'
  28. - name: Gather facts
  29. import_playbook: facts.yml
  30. when: reset_nodes | default(True) | bool
  31. - name: Reset node
  32. hosts: "{{ node | default('kube_node') }}"
  33. gather_facts: no
  34. environment: "{{ proxy_disable_env }}"
  35. roles:
  36. - { role: kubespray-defaults, when: reset_nodes | default(True) | bool }
  37. - { role: remove-node/pre-remove, tags: pre-remove }
  38. - { role: remove-node/remove-etcd-node }
  39. - { role: reset, tags: reset, when: reset_nodes | default(True) | bool }
  40. # Currently cannot remove first master or etcd
  41. - name: Post node removal
  42. hosts: "{{ node | default('kube_control_plane[1:]:etcd[1:]') }}"
  43. gather_facts: no
  44. environment: "{{ proxy_disable_env }}"
  45. roles:
  46. - { role: kubespray-defaults, when: reset_nodes | default(True) | bool }
  47. - { role: remove-node/post-remove, tags: post-remove }