From 81033d58030f9d1c1207cbfe487e0421c7cdd7be Mon Sep 17 00:00:00 2001 From: Saravanakumar Arumugam Date: Wed, 7 Feb 2018 14:52:46 +0530 Subject: uninstall playbook for GlusterFS Signed-off-by: Saravanakumar Arumugam --- .../tasks/glusterfs_config.yml | 52 +--------- .../tasks/glusterfs_config_facts.yml | 51 +++++++++ .../tasks/glusterfs_registry.yml | 51 +-------- .../tasks/glusterfs_registry_facts.yml | 51 +++++++++ .../tasks/glusterfs_uninstall.yml | 114 +++++++++++++++++++++ .../tasks/uninstall.yml | 10 ++ 6 files changed, 228 insertions(+), 101 deletions(-) create mode 100644 roles/openshift_storage_glusterfs/tasks/glusterfs_config_facts.yml create mode 100644 roles/openshift_storage_glusterfs/tasks/glusterfs_registry_facts.yml create mode 100644 roles/openshift_storage_glusterfs/tasks/glusterfs_uninstall.yml create mode 100644 roles/openshift_storage_glusterfs/tasks/uninstall.yml (limited to 'roles') diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_config.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_config.yml index 92de1b64d..b50050956 100644 --- a/roles/openshift_storage_glusterfs/tasks/glusterfs_config.yml +++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_config.yml @@ -1,53 +1,3 @@ --- -- set_fact: - glusterfs_timeout: "{{ openshift_storage_glusterfs_timeout }}" - glusterfs_namespace: "{{ openshift_storage_glusterfs_namespace }}" - glusterfs_is_native: "{{ openshift_storage_glusterfs_is_native | bool }}" - glusterfs_name: "{{ openshift_storage_glusterfs_name }}" - # map_from_pairs is a custom filter plugin in role lib_utils - glusterfs_nodeselector: "{{ openshift_storage_glusterfs_nodeselector | default(['storagenode', openshift_storage_glusterfs_name] | join('=')) | map_from_pairs }}" - glusterfs_use_default_selector: "{{ openshift_storage_glusterfs_use_default_selector }}" - glusterfs_storageclass: "{{ openshift_storage_glusterfs_storageclass }}" - glusterfs_storageclass_default: "{{ openshift_storage_glusterfs_storageclass_default | bool }}" - glusterfs_image: "{{ openshift_storage_glusterfs_image }}" - glusterfs_version: "{{ openshift_storage_glusterfs_version }}" - glusterfs_block_deploy: "{{ openshift_storage_glusterfs_block_deploy | bool }}" - glusterfs_block_image: "{{ openshift_storage_glusterfs_block_image }}" - glusterfs_block_version: "{{ openshift_storage_glusterfs_block_version }}" - glusterfs_block_host_vol_create: "{{ openshift_storage_glusterfs_block_host_vol_create }}" - glusterfs_block_host_vol_size: "{{ openshift_storage_glusterfs_block_host_vol_size }}" - glusterfs_block_host_vol_max: "{{ openshift_storage_glusterfs_block_host_vol_max }}" - glusterfs_block_storageclass: "{{ openshift_storage_glusterfs_block_storageclass | bool }}" - glusterfs_block_storageclass_default: "{{ openshift_storage_glusterfs_block_storageclass_default | bool }}" - glusterfs_s3_deploy: "{{ openshift_storage_glusterfs_s3_deploy | bool }}" - glusterfs_s3_image: "{{ openshift_storage_glusterfs_s3_image }}" - glusterfs_s3_version: "{{ openshift_storage_glusterfs_s3_version }}" - glusterfs_s3_account: "{{ openshift_storage_glusterfs_s3_account }}" - glusterfs_s3_user: "{{ openshift_storage_glusterfs_s3_user }}" - glusterfs_s3_password: "{{ openshift_storage_glusterfs_s3_password }}" - glusterfs_s3_pvc: "{{ openshift_storage_glusterfs_s3_pvc }}" - glusterfs_s3_pvc_size: "{{ openshift_storage_glusterfs_s3_pvc_size }}" - glusterfs_s3_meta_pvc: "{{ openshift_storage_glusterfs_s3_meta_pvc }}" - glusterfs_s3_meta_pvc_size: "{{ openshift_storage_glusterfs_s3_meta_pvc_size }}" - glusterfs_wipe: "{{ openshift_storage_glusterfs_wipe | bool }}" - glusterfs_heketi_is_native: "{{ openshift_storage_glusterfs_heketi_is_native | bool }}" - glusterfs_heketi_is_missing: "{{ openshift_storage_glusterfs_heketi_is_missing | bool }}" - glusterfs_heketi_deploy_is_missing: "{{ openshift_storage_glusterfs_heketi_deploy_is_missing | bool }}" - glusterfs_heketi_cli: "{{ openshift_storage_glusterfs_heketi_cli }}" - glusterfs_heketi_image: "{{ openshift_storage_glusterfs_heketi_image }}" - glusterfs_heketi_version: "{{ openshift_storage_glusterfs_heketi_version }}" - glusterfs_heketi_admin_key: "{{ openshift_storage_glusterfs_heketi_admin_key }}" - glusterfs_heketi_user_key: "{{ openshift_storage_glusterfs_heketi_user_key }}" - glusterfs_heketi_topology_load: "{{ openshift_storage_glusterfs_heketi_topology_load | bool }}" - glusterfs_heketi_wipe: "{{ openshift_storage_glusterfs_heketi_wipe | bool }}" - glusterfs_heketi_url: "{{ openshift_storage_glusterfs_heketi_url }}" - glusterfs_heketi_port: "{{ openshift_storage_glusterfs_heketi_port }}" - glusterfs_heketi_executor: "{{ openshift_storage_glusterfs_heketi_executor }}" - glusterfs_heketi_ssh_port: "{{ openshift_storage_glusterfs_heketi_ssh_port }}" - glusterfs_heketi_ssh_user: "{{ openshift_storage_glusterfs_heketi_ssh_user }}" - glusterfs_heketi_ssh_sudo: "{{ openshift_storage_glusterfs_heketi_ssh_sudo | bool }}" - glusterfs_heketi_ssh_keyfile: "{{ openshift_storage_glusterfs_heketi_ssh_keyfile }}" - glusterfs_heketi_fstab: "{{ openshift_storage_glusterfs_heketi_fstab }}" - glusterfs_nodes: "{{ groups.glusterfs | default([]) }}" - +- include_tasks: glusterfs_config_facts.yml - include_tasks: glusterfs_common.yml diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_config_facts.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_config_facts.yml new file mode 100644 index 000000000..67d30bf25 --- /dev/null +++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_config_facts.yml @@ -0,0 +1,51 @@ +--- +- set_fact: + glusterfs_timeout: "{{ openshift_storage_glusterfs_timeout }}" + glusterfs_namespace: "{{ openshift_storage_glusterfs_namespace }}" + glusterfs_is_native: "{{ openshift_storage_glusterfs_is_native | bool }}" + glusterfs_name: "{{ openshift_storage_glusterfs_name }}" + # map_from_pairs is a custom filter plugin in role lib_utils + glusterfs_nodeselector: "{{ openshift_storage_glusterfs_nodeselector | default(['storagenode', openshift_storage_glusterfs_name] | join('=')) | map_from_pairs }}" + glusterfs_use_default_selector: "{{ openshift_storage_glusterfs_use_default_selector }}" + glusterfs_storageclass: "{{ openshift_storage_glusterfs_storageclass }}" + glusterfs_storageclass_default: "{{ openshift_storage_glusterfs_storageclass_default | bool }}" + glusterfs_image: "{{ openshift_storage_glusterfs_image }}" + glusterfs_version: "{{ openshift_storage_glusterfs_version }}" + glusterfs_block_deploy: "{{ openshift_storage_glusterfs_block_deploy | bool }}" + glusterfs_block_image: "{{ openshift_storage_glusterfs_block_image }}" + glusterfs_block_version: "{{ openshift_storage_glusterfs_block_version }}" + glusterfs_block_host_vol_create: "{{ openshift_storage_glusterfs_block_host_vol_create }}" + glusterfs_block_host_vol_size: "{{ openshift_storage_glusterfs_block_host_vol_size }}" + glusterfs_block_host_vol_max: "{{ openshift_storage_glusterfs_block_host_vol_max }}" + glusterfs_block_storageclass: "{{ openshift_storage_glusterfs_block_storageclass | bool }}" + glusterfs_block_storageclass_default: "{{ openshift_storage_glusterfs_block_storageclass_default | bool }}" + glusterfs_s3_deploy: "{{ openshift_storage_glusterfs_s3_deploy | bool }}" + glusterfs_s3_image: "{{ openshift_storage_glusterfs_s3_image }}" + glusterfs_s3_version: "{{ openshift_storage_glusterfs_s3_version }}" + glusterfs_s3_account: "{{ openshift_storage_glusterfs_s3_account }}" + glusterfs_s3_user: "{{ openshift_storage_glusterfs_s3_user }}" + glusterfs_s3_password: "{{ openshift_storage_glusterfs_s3_password }}" + glusterfs_s3_pvc: "{{ openshift_storage_glusterfs_s3_pvc }}" + glusterfs_s3_pvc_size: "{{ openshift_storage_glusterfs_s3_pvc_size }}" + glusterfs_s3_meta_pvc: "{{ openshift_storage_glusterfs_s3_meta_pvc }}" + glusterfs_s3_meta_pvc_size: "{{ openshift_storage_glusterfs_s3_meta_pvc_size }}" + glusterfs_wipe: "{{ openshift_storage_glusterfs_wipe | bool }}" + glusterfs_heketi_is_native: "{{ openshift_storage_glusterfs_heketi_is_native | bool }}" + glusterfs_heketi_is_missing: "{{ openshift_storage_glusterfs_heketi_is_missing | bool }}" + glusterfs_heketi_deploy_is_missing: "{{ openshift_storage_glusterfs_heketi_deploy_is_missing | bool }}" + glusterfs_heketi_cli: "{{ openshift_storage_glusterfs_heketi_cli }}" + glusterfs_heketi_image: "{{ openshift_storage_glusterfs_heketi_image }}" + glusterfs_heketi_version: "{{ openshift_storage_glusterfs_heketi_version }}" + glusterfs_heketi_admin_key: "{{ openshift_storage_glusterfs_heketi_admin_key }}" + glusterfs_heketi_user_key: "{{ openshift_storage_glusterfs_heketi_user_key }}" + glusterfs_heketi_topology_load: "{{ openshift_storage_glusterfs_heketi_topology_load | bool }}" + glusterfs_heketi_wipe: "{{ openshift_storage_glusterfs_heketi_wipe | bool }}" + glusterfs_heketi_url: "{{ openshift_storage_glusterfs_heketi_url }}" + glusterfs_heketi_port: "{{ openshift_storage_glusterfs_heketi_port }}" + glusterfs_heketi_executor: "{{ openshift_storage_glusterfs_heketi_executor }}" + glusterfs_heketi_ssh_port: "{{ openshift_storage_glusterfs_heketi_ssh_port }}" + glusterfs_heketi_ssh_user: "{{ openshift_storage_glusterfs_heketi_ssh_user }}" + glusterfs_heketi_ssh_sudo: "{{ openshift_storage_glusterfs_heketi_ssh_sudo | bool }}" + glusterfs_heketi_ssh_keyfile: "{{ openshift_storage_glusterfs_heketi_ssh_keyfile }}" + glusterfs_heketi_fstab: "{{ openshift_storage_glusterfs_heketi_fstab }}" + glusterfs_nodes: "{{ groups.glusterfs | default([]) }}" diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml index 10c29fd37..e91e13033 100644 --- a/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml +++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml @@ -1,54 +1,5 @@ --- -- set_fact: - glusterfs_timeout: "{{ openshift_storage_glusterfs_registry_timeout }}" - glusterfs_namespace: "{{ openshift_storage_glusterfs_registry_namespace }}" - glusterfs_is_native: "{{ openshift_storage_glusterfs_registry_is_native | bool }}" - glusterfs_name: "{{ openshift_storage_glusterfs_registry_name }}" - # map_from_pairs is a custom filter plugin in role lib_utils - glusterfs_nodeselector: "{{ openshift_storage_glusterfs_registry_nodeselector | default(['storagenode', openshift_storage_glusterfs_registry_name] | join('=')) | map_from_pairs }}" - glusterfs_use_default_selector: "{{ openshift_storage_glusterfs_registry_use_default_selector }}" - glusterfs_storageclass: "{{ openshift_storage_glusterfs_registry_storageclass }}" - glusterfs_storageclass_default: "{{ openshift_storage_glusterfs_registry_storageclass_default | bool }}" - glusterfs_image: "{{ openshift_storage_glusterfs_registry_image }}" - glusterfs_version: "{{ openshift_storage_glusterfs_registry_version }}" - glusterfs_block_deploy: "{{ openshift_storage_glusterfs_registry_block_deploy | bool }}" - glusterfs_block_image: "{{ openshift_storage_glusterfs_registry_block_image }}" - glusterfs_block_version: "{{ openshift_storage_glusterfs_registry_block_version }}" - glusterfs_block_host_vol_create: "{{ openshift_storage_glusterfs_registry_block_host_vol_create }}" - glusterfs_block_host_vol_size: "{{ openshift_storage_glusterfs_registry_block_host_vol_size }}" - glusterfs_block_host_vol_max: "{{ openshift_storage_glusterfs_registry_block_host_vol_max }}" - glusterfs_block_storageclass: "{{ openshift_storage_glusterfs_registry_block_storageclass | bool }}" - glusterfs_block_storageclass_default: "{{ openshift_storage_glusterfs_registry_block_storageclass_default | bool }}" - glusterfs_s3_deploy: "{{ openshift_storage_glusterfs_registry_s3_deploy | bool }}" - glusterfs_s3_image: "{{ openshift_storage_glusterfs_registry_s3_image }}" - glusterfs_s3_version: "{{ openshift_storage_glusterfs_registry_s3_version }}" - glusterfs_s3_account: "{{ openshift_storage_glusterfs_registry_s3_account }}" - glusterfs_s3_user: "{{ openshift_storage_glusterfs_registry_s3_user }}" - glusterfs_s3_password: "{{ openshift_storage_glusterfs_registry_s3_password }}" - glusterfs_s3_pvc: "{{ openshift_storage_glusterfs_registry_s3_pvc }}" - glusterfs_s3_pvc_size: "{{ openshift_storage_glusterfs_registry_s3_pvc_size }}" - glusterfs_s3_meta_pvc: "{{ openshift_storage_glusterfs_registry_s3_meta_pvc }}" - glusterfs_s3_meta_pvc_size: "{{ openshift_storage_glusterfs_registry_s3_meta_pvc_size }}" - glusterfs_wipe: "{{ openshift_storage_glusterfs_registry_wipe | bool }}" - glusterfs_heketi_is_native: "{{ openshift_storage_glusterfs_registry_heketi_is_native | bool }}" - glusterfs_heketi_is_missing: "{{ openshift_storage_glusterfs_registry_heketi_is_missing | bool }}" - glusterfs_heketi_deploy_is_missing: "{{ openshift_storage_glusterfs_registry_heketi_deploy_is_missing | bool }}" - glusterfs_heketi_cli: "{{ openshift_storage_glusterfs_registry_heketi_cli }}" - glusterfs_heketi_image: "{{ openshift_storage_glusterfs_registry_heketi_image }}" - glusterfs_heketi_version: "{{ openshift_storage_glusterfs_registry_heketi_version }}" - glusterfs_heketi_admin_key: "{{ openshift_storage_glusterfs_registry_heketi_admin_key }}" - glusterfs_heketi_user_key: "{{ openshift_storage_glusterfs_registry_heketi_user_key }}" - glusterfs_heketi_topology_load: "{{ openshift_storage_glusterfs_registry_heketi_topology_load | bool }}" - glusterfs_heketi_wipe: "{{ openshift_storage_glusterfs_registry_heketi_wipe | bool }}" - glusterfs_heketi_url: "{{ openshift_storage_glusterfs_registry_heketi_url }}" - glusterfs_heketi_port: "{{ openshift_storage_glusterfs_registry_heketi_port }}" - glusterfs_heketi_executor: "{{ openshift_storage_glusterfs_registry_heketi_executor }}" - glusterfs_heketi_ssh_port: "{{ openshift_storage_glusterfs_registry_heketi_ssh_port }}" - glusterfs_heketi_ssh_user: "{{ openshift_storage_glusterfs_registry_heketi_ssh_user }}" - glusterfs_heketi_ssh_sudo: "{{ openshift_storage_glusterfs_registry_heketi_ssh_sudo | bool }}" - glusterfs_heketi_ssh_keyfile: "{{ openshift_storage_glusterfs_registry_heketi_ssh_keyfile }}" - glusterfs_heketi_fstab: "{{ openshift_storage_glusterfs_registry_heketi_fstab }}" - glusterfs_nodes: "{% if groups.glusterfs_registry is defined and groups['glusterfs_registry'] | length > 0 %}{% set nodes = groups.glusterfs_registry %}{% elif 'groups.glusterfs' is defined and groups['glusterfs'] | length > 0 %}{% set nodes = groups.glusterfs %}{% else %}{% set nodes = '[]' %}{% endif %}{{ nodes }}" +- include_tasks: glusterfs_registry_facts.yml - include_tasks: glusterfs_common.yml when: diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_registry_facts.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry_facts.yml new file mode 100644 index 000000000..5fa5f0895 --- /dev/null +++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry_facts.yml @@ -0,0 +1,51 @@ +--- +- set_fact: + glusterfs_timeout: "{{ openshift_storage_glusterfs_registry_timeout }}" + glusterfs_namespace: "{{ openshift_storage_glusterfs_registry_namespace }}" + glusterfs_is_native: "{{ openshift_storage_glusterfs_registry_is_native | bool }}" + glusterfs_name: "{{ openshift_storage_glusterfs_registry_name }}" + # map_from_pairs is a custom filter plugin in role lib_utils + glusterfs_nodeselector: "{{ openshift_storage_glusterfs_registry_nodeselector | default(['storagenode', openshift_storage_glusterfs_registry_name] | join('=')) | map_from_pairs }}" + glusterfs_use_default_selector: "{{ openshift_storage_glusterfs_registry_use_default_selector }}" + glusterfs_storageclass: "{{ openshift_storage_glusterfs_registry_storageclass }}" + glusterfs_storageclass_default: "{{ openshift_storage_glusterfs_registry_storageclass_default | bool }}" + glusterfs_image: "{{ openshift_storage_glusterfs_registry_image }}" + glusterfs_version: "{{ openshift_storage_glusterfs_registry_version }}" + glusterfs_block_deploy: "{{ openshift_storage_glusterfs_registry_block_deploy | bool }}" + glusterfs_block_image: "{{ openshift_storage_glusterfs_registry_block_image }}" + glusterfs_block_version: "{{ openshift_storage_glusterfs_registry_block_version }}" + glusterfs_block_host_vol_create: "{{ openshift_storage_glusterfs_registry_block_host_vol_create }}" + glusterfs_block_host_vol_size: "{{ openshift_storage_glusterfs_registry_block_host_vol_size }}" + glusterfs_block_host_vol_max: "{{ openshift_storage_glusterfs_registry_block_host_vol_max }}" + glusterfs_block_storageclass: "{{ openshift_storage_glusterfs_registry_block_storageclass | bool }}" + glusterfs_block_storageclass_default: "{{ openshift_storage_glusterfs_registry_block_storageclass_default | bool }}" + glusterfs_s3_deploy: "{{ openshift_storage_glusterfs_registry_s3_deploy | bool }}" + glusterfs_s3_image: "{{ openshift_storage_glusterfs_registry_s3_image }}" + glusterfs_s3_version: "{{ openshift_storage_glusterfs_registry_s3_version }}" + glusterfs_s3_account: "{{ openshift_storage_glusterfs_registry_s3_account }}" + glusterfs_s3_user: "{{ openshift_storage_glusterfs_registry_s3_user }}" + glusterfs_s3_password: "{{ openshift_storage_glusterfs_registry_s3_password }}" + glusterfs_s3_pvc: "{{ openshift_storage_glusterfs_registry_s3_pvc }}" + glusterfs_s3_pvc_size: "{{ openshift_storage_glusterfs_registry_s3_pvc_size }}" + glusterfs_s3_meta_pvc: "{{ openshift_storage_glusterfs_registry_s3_meta_pvc }}" + glusterfs_s3_meta_pvc_size: "{{ openshift_storage_glusterfs_registry_s3_meta_pvc_size }}" + glusterfs_wipe: "{{ openshift_storage_glusterfs_registry_wipe | bool }}" + glusterfs_heketi_is_native: "{{ openshift_storage_glusterfs_registry_heketi_is_native | bool }}" + glusterfs_heketi_is_missing: "{{ openshift_storage_glusterfs_registry_heketi_is_missing | bool }}" + glusterfs_heketi_deploy_is_missing: "{{ openshift_storage_glusterfs_registry_heketi_deploy_is_missing | bool }}" + glusterfs_heketi_cli: "{{ openshift_storage_glusterfs_registry_heketi_cli }}" + glusterfs_heketi_image: "{{ openshift_storage_glusterfs_registry_heketi_image }}" + glusterfs_heketi_version: "{{ openshift_storage_glusterfs_registry_heketi_version }}" + glusterfs_heketi_admin_key: "{{ openshift_storage_glusterfs_registry_heketi_admin_key }}" + glusterfs_heketi_user_key: "{{ openshift_storage_glusterfs_registry_heketi_user_key }}" + glusterfs_heketi_topology_load: "{{ openshift_storage_glusterfs_registry_heketi_topology_load | bool }}" + glusterfs_heketi_wipe: "{{ openshift_storage_glusterfs_registry_heketi_wipe | bool }}" + glusterfs_heketi_url: "{{ openshift_storage_glusterfs_registry_heketi_url }}" + glusterfs_heketi_port: "{{ openshift_storage_glusterfs_registry_heketi_port }}" + glusterfs_heketi_executor: "{{ openshift_storage_glusterfs_registry_heketi_executor }}" + glusterfs_heketi_ssh_port: "{{ openshift_storage_glusterfs_registry_heketi_ssh_port }}" + glusterfs_heketi_ssh_user: "{{ openshift_storage_glusterfs_registry_heketi_ssh_user }}" + glusterfs_heketi_ssh_sudo: "{{ openshift_storage_glusterfs_registry_heketi_ssh_sudo | bool }}" + glusterfs_heketi_ssh_keyfile: "{{ openshift_storage_glusterfs_registry_heketi_ssh_keyfile }}" + glusterfs_heketi_fstab: "{{ openshift_storage_glusterfs_registry_heketi_fstab }}" + glusterfs_nodes: "{% if groups.glusterfs_registry is defined and groups['glusterfs_registry'] | length > 0 %}{% set nodes = groups.glusterfs_registry %}{% elif 'groups.glusterfs' is defined and groups['glusterfs'] | length > 0 %}{% set nodes = groups.glusterfs %}{% else %}{% set nodes = '[]' %}{% endif %}{{ nodes }}" diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_uninstall.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_uninstall.yml new file mode 100644 index 000000000..2d8ca676b --- /dev/null +++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_uninstall.yml @@ -0,0 +1,114 @@ +--- + +- name: Delete pre-existing heketi resources + oc_obj: + namespace: "{{ glusterfs_namespace }}" + kind: "{{ item.kind }}" + name: "{{ item.name | default(omit) }}" + selector: "{{ item.selector | default(omit) }}" + state: absent + with_items: + - kind: "template,route,service,dc,jobs,secret" + selector: "deploy-heketi" + - kind: "svc" + name: "heketi-storage-endpoints" + - kind: "svc" + name: "heketi-storage" + - kind: "secret" + name: "heketi-{{ glusterfs_name }}-topology-secret" + - kind: "template,route,service,dc" + name: "heketi-{{ glusterfs_name }}" + - kind: "svc" + name: "heketi-db-{{ glusterfs_name }}-endpoints" + - kind: "sa" + name: "heketi-{{ glusterfs_name }}-service-account" + - kind: "secret" + name: "heketi-{{ glusterfs_name }}-admin-secret" + - kind: "secret" + name: "heketi-{{ glusterfs_name }}-config-secret" + failed_when: False + +- name: Delete pre-existing GlusterFS resources + oc_obj: + namespace: "{{ glusterfs_namespace }}" + kind: "{{ item.kind }}" + name: "{{ item.name }}" + state: absent + with_items: + - kind: template + name: glusterfs + - kind: daemonset + name: "glusterfs-{{ glusterfs_name }}" + - kind: storageclass + name: "glusterfs-{{ glusterfs_name }}" + +- name: Unlabel any existing GlusterFS nodes + oc_label: + name: "{{ hostvars[item].openshift.node.nodename }}" + kind: node + state: absent + labels: "{{ glusterfs_nodeselector | lib_utils_oo_dict_to_list_of_dict }}" + with_items: "{{ groups.all }}" + +- name: Delete pre-existing GlusterFS config + file: + path: /var/lib/glusterd + state: absent + delegate_to: "{{ item }}" + with_items: "{{ glusterfs_nodes | default([]) }}" + +- name: Delete pre-existing additional GlusterFS config + file: + path: /etc/glusterfs + state: absent + delegate_to: "{{ item }}" + with_items: "{{ glusterfs_nodes | default([]) }}" + +- name: Delete pre-existing Heketi config + file: + path: /var/lib/heketi + state: absent + delegate_to: "{{ item }}" + with_items: "{{ glusterfs_nodes | default([]) }}" + +- name: Delete Glusterfs logs + file: + path: /var/log/glusterfs + state: absent + delegate_to: "{{ item }}" + with_items: "{{ glusterfs_nodes | default([]) }}" + +- name: Delete deploy resources + oc_obj: + namespace: "{{ glusterfs_namespace }}" + kind: "{{ item.kind }}" + name: "{{ item.name | default(omit) }}" + selector: "{{ item.selector | default(omit) }}" + state: absent + with_items: + - kind: "template,route,service,jobs,dc,secret" + selector: "deploy-heketi" + - kind: "svc" + name: "heketi-storage-endpoints" + - kind: "secret" + name: "heketi-{{ glusterfs_name }}-topology-secret" + +- name: Get GlusterFS storage devices state + command: "pvdisplay -C --noheadings -o pv_name,vg_name {% for device in hostvars[item].glusterfs_devices %}{{ device }} {% endfor %}" + register: devices_info + delegate_to: "{{ item }}" + with_items: "{{ glusterfs_nodes | default([]) }}" + failed_when: False + + # Runs "lvremove -ff ; vgremove -fy ; pvremove -fy " for every device found to be a physical volume. +- name: Clear GlusterFS storage device contents + shell: "{% for line in item.stdout_lines %}{% set fields = line.split() %}{% if fields | count > 1 %}lvremove -ff {{ fields[1] }}; vgremove -fy {{ fields[1] }}; {% endif %}pvremove -fy {{ fields[0] }}; {% endfor %}" + delegate_to: "{{ item.item }}" + with_items: "{{ devices_info.results }}" + register: clear_devices + until: + - "'contains a filesystem in use' not in clear_devices.stderr" + delay: 1 + retries: 30 + when: + - item.stdout_lines | count > 0 diff --git a/roles/openshift_storage_glusterfs/tasks/uninstall.yml b/roles/openshift_storage_glusterfs/tasks/uninstall.yml new file mode 100644 index 000000000..148b8d65d --- /dev/null +++ b/roles/openshift_storage_glusterfs/tasks/uninstall.yml @@ -0,0 +1,10 @@ +--- +- block: + - include_tasks: glusterfs_config_facts.yml + - include_tasks: glusterfs_uninstall.yml + when: "'glusterfs' in groups and groups['glusterfs'] | length > 0" + +- block: + - include_tasks: glusterfs_registry_facts.yml + - include_tasks: glusterfs_uninstall.yml + when: "'glusterfs_registry' in groups and groups['glusterfs_registry'] | length > 0" -- cgit v1.2.3