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.

55 lines
1.8 KiB

  1. ---
  2. - name: Check ansible version
  3. import_playbook: ansible_version.yml
  4. - hosts: all
  5. gather_facts: false
  6. tags: always
  7. tasks:
  8. - name: "Set up proxy environment"
  9. set_fact:
  10. proxy_env:
  11. http_proxy: "{{ http_proxy | default ('') }}"
  12. HTTP_PROXY: "{{ http_proxy | default ('') }}"
  13. https_proxy: "{{ https_proxy | default ('') }}"
  14. HTTPS_PROXY: "{{ https_proxy | default ('') }}"
  15. no_proxy: "{{ no_proxy | default ('') }}"
  16. NO_PROXY: "{{ no_proxy | default ('') }}"
  17. no_log: true
  18. - hosts: "{{ node | default('etcd:k8s-cluster:calico-rr') }}"
  19. gather_facts: no
  20. vars_prompt:
  21. name: "delete_nodes_confirmation"
  22. prompt: "Are you sure you want to delete nodes state? Type 'yes' to delete nodes."
  23. default: "no"
  24. private: no
  25. pre_tasks:
  26. - name: check confirmation
  27. fail:
  28. msg: "Delete nodes confirmation failed"
  29. when: delete_nodes_confirmation != "yes"
  30. - hosts: kube-master[0]
  31. gather_facts: no
  32. roles:
  33. - { role: kubespray-defaults }
  34. - { role: bootstrap-os, tags: bootstrap-os }
  35. - { role: remove-node/pre-remove, tags: pre-remove }
  36. - hosts: "{{ node | default('kube-node') }}"
  37. gather_facts: no
  38. roles:
  39. - { role: kubespray-defaults, when: reset_nodes|default(True)|bool }
  40. - { role: bootstrap-os, tags: bootstrap-os, when: reset_nodes|default(True)|bool }
  41. - { role: remove-node/remove-etcd-node }
  42. - { role: reset, tags: reset, when: reset_nodes|default(True)|bool }
  43. # Currently cannot remove first master or etcd
  44. - hosts: "{{ node | default('kube-master[1:]:etcd[1:]') }}"
  45. gather_facts: no
  46. roles:
  47. - { role: kubespray-defaults, when: reset_nodes|default(True)|bool }
  48. - { role: bootstrap-os, tags: bootstrap-os, when: reset_nodes|default(True)|bool }
  49. - { role: remove-node/post-remove, tags: post-remove }