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.

51 lines
2.4 KiB

  1. ---
  2. - name: "Remove storage class."
  3. command: "{{ bin_dir }}/kubectl delete storageclass gluster"
  4. ignore_errors: true
  5. - name: "Tear down heketi."
  6. command: "{{ bin_dir }}/kubectl delete all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-pod\""
  7. ignore_errors: true
  8. - name: "Tear down heketi."
  9. command: "{{ bin_dir }}/kubectl delete all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-deployment\""
  10. ignore_errors: true
  11. - name: "Tear down bootstrap."
  12. include_tasks: "../provision/tasks/bootstrap/tear-down.yml"
  13. - name: "Ensure there is nothing left over."
  14. command: "{{ bin_dir }}/kubectl get all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-pod\" -o=json"
  15. register: "heketi_result"
  16. until: "heketi_result.stdout|from_json|json_query('items[*]')|length == 0"
  17. retries: 60
  18. delay: 5
  19. - name: "Ensure there is nothing left over."
  20. command: "{{ bin_dir }}/kubectl get all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-deployment\" -o=json"
  21. register: "heketi_result"
  22. until: "heketi_result.stdout|from_json|json_query('items[*]')|length == 0"
  23. retries: 60
  24. delay: 5
  25. - name: "Tear down glusterfs."
  26. command: "{{ bin_dir }}/kubectl delete daemonset.extensions/glusterfs"
  27. ignore_errors: true
  28. - name: "Remove heketi storage service."
  29. command: "{{ bin_dir }}/kubectl delete service heketi-storage-endpoints"
  30. ignore_errors: true
  31. - name: "Remove heketi gluster role binding"
  32. command: "{{ bin_dir }}/kubectl delete clusterrolebinding heketi-gluster-admin"
  33. ignore_errors: true
  34. - name: "Remove heketi config secret"
  35. command: "{{ bin_dir }}/kubectl delete secret heketi-config-secret"
  36. ignore_errors: true
  37. - name: "Remove heketi db backup"
  38. command: "{{ bin_dir }}/kubectl delete secret heketi-db-backup"
  39. ignore_errors: true
  40. - name: "Remove heketi service account"
  41. command: "{{ bin_dir }}/kubectl delete serviceaccount heketi-service-account"
  42. ignore_errors: true
  43. - name: "Get secrets"
  44. command: "{{ bin_dir }}/kubectl get secrets --output=\"json\""
  45. register: "secrets"
  46. changed_when: false
  47. - name: "Remove heketi storage secret"
  48. vars: { storage_query: "items[?metadata.annotations.\"kubernetes.io/service-account.name\"=='heketi-service-account'].metadata.name|[0]" }
  49. command: "{{ bin_dir }}/kubectl delete secret {{ secrets.stdout|from_json|json_query(storage_query) }}"
  50. when: "storage_query is defined"
  51. ignore_errors: true