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.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. - 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/remove-etcd-node }
  34. - { role: reset, tags: reset, when: reset_nodes|default(True)|bool }
  35. # Currently cannot remove first master or etcd
  36. - hosts: "{{ node | default('kube_control_plane[1:]:etcd[1:]') }}"
  37. gather_facts: no
  38. environment: "{{ proxy_disable_env }}"
  39. roles:
  40. - { role: kubespray-defaults, when: reset_nodes|default(True)|bool }
  41. - { role: remove-node/post-remove, tags: post-remove }