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.

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