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