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.

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