2018-07-05 08:15:05 +08:00
|
|
|
---
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Remove storage class.
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete storageclass gluster"
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Tear down heketi.
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-pod\""
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Tear down heketi.
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-deployment\""
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
|
|
|
- name: Tear down bootstrap.
|
2020-08-27 14:19:10 +08:00
|
|
|
include_tasks: "../../provision/tasks/bootstrap/tear-down.yml"
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Ensure there is nothing left over.
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl get all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-pod\" -o=json"
|
2018-07-05 08:15:05 +08:00
|
|
|
register: "heketi_result"
|
2023-07-05 11:36:54 +08:00
|
|
|
until: "heketi_result.stdout | from_json | json_query('items[*]') | length == 0"
|
2018-07-05 08:15:05 +08:00
|
|
|
retries: 60
|
|
|
|
delay: 5
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Ensure there is nothing left over.
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl get all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-deployment\" -o=json"
|
2018-07-05 08:15:05 +08:00
|
|
|
register: "heketi_result"
|
2023-07-05 11:36:54 +08:00
|
|
|
until: "heketi_result.stdout | from_json | json_query('items[*]') | length == 0"
|
2018-07-05 08:15:05 +08:00
|
|
|
retries: 60
|
|
|
|
delay: 5
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Tear down glusterfs.
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete daemonset.extensions/glusterfs"
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Remove heketi storage service.
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete service heketi-storage-endpoints"
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Remove heketi gluster role binding
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete clusterrolebinding heketi-gluster-admin"
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Remove heketi config secret
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete secret heketi-config-secret"
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Remove heketi db backup
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete secret heketi-db-backup"
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Remove heketi service account
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete serviceaccount heketi-service-account"
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
|
|
|
- name: Get secrets
|
2018-07-30 23:44:02 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl get secrets --output=\"json\""
|
2018-07-05 08:15:05 +08:00
|
|
|
register: "secrets"
|
|
|
|
changed_when: false
|
2021-07-12 15:00:47 +08:00
|
|
|
- name: Remove heketi storage secret
|
2018-07-05 08:15:05 +08:00
|
|
|
vars: { storage_query: "items[?metadata.annotations.\"kubernetes.io/service-account.name\"=='heketi-service-account'].metadata.name|[0]" }
|
2023-07-05 11:36:54 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl delete secret {{ secrets.stdout | from_json | json_query(storage_query) }}"
|
2018-07-05 08:15:05 +08:00
|
|
|
when: "storage_query is defined"
|
2021-07-12 15:00:47 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|