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.

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