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.

47 lines
1.6 KiB

  1. ---
  2. - name: Common tasks for every playbooks
  3. import_playbook: boilerplate.yml
  4. - name: Confirm node removal
  5. hosts: "{{ node | default('etcd:k8s_cluster:calico_rr') }}"
  6. gather_facts: no
  7. tasks:
  8. - name: Confirm Execution
  9. pause:
  10. prompt: "Are you sure you want to delete nodes state? Type 'yes' to delete nodes."
  11. register: pause_result
  12. run_once: True
  13. when:
  14. - not (skip_confirmation | default(false) | bool)
  15. - name: Fail if user does not confirm deletion
  16. fail:
  17. msg: "Delete nodes confirmation failed"
  18. when: pause_result.user_input | default('yes') != 'yes'
  19. - name: Gather facts
  20. import_playbook: facts.yml
  21. when: reset_nodes | default(True) | bool
  22. - name: Reset node
  23. hosts: "{{ node | default('kube_node') }}"
  24. gather_facts: no
  25. environment: "{{ proxy_disable_env }}"
  26. pre_tasks:
  27. - name: Gather information about installed services
  28. service_facts:
  29. when: reset_nodes | default(True) | bool
  30. roles:
  31. - { role: kubespray-defaults, when: reset_nodes | default(True) | bool }
  32. - { role: remove-node/pre-remove, tags: pre-remove }
  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. - name: Post node removal
  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 }