forked from gluster/gluster-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gluster_cleanup.yml
72 lines (64 loc) · 2 KB
/
gluster_cleanup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
- name: Remove gluster setup
hosts: hc_nodes
remote_user: root
gather_facts: False
ignore_errors: True
tasks:
- name: Delete the volumes
gluster_volume:
state: absent
name: "{{ item.volname }}"
run_once: True
with_items: "{{ gluster_features_hci_volumes }}"
when: gluster_features_hci_volumes is defined
tags:
- delete_volumes
# Remove the brick directories
- name: Remove brick directories
file:
state: absent
path: "{{ item.brick }}"
with_items: "{{ gluster_features_hci_volumes }}"
when: gluster_features_hci_volumes is defined
- name: Unmount the disks
mount:
state: absent
path: "{{ item.path }}"
with_items: "{{ gluster_infra_mount_devices }}"
- name: Wipe filesystem from LVs
shell: wipefs -a /dev/{{ item.vgname }}/{{ item.lvname}}
register: shell_output
changed_when: shell_output.rc == 0
failed_when: False
with_items: "{{ gluster_infra_mount_devices }}"
- name: Delete volume groups
lvg:
vg: "{{ item.vgname }}"
state: absent
force: yes
with_items: "{{ gluster_infra_volume_groups }}"
when: gluster_infra_volume_groups is defined
- name: Remove PV
shell: pvremove {{ item.pvname }} -ff
register: shell_output
changed_when: shell_output.rc == 0
with_items: "{{ gluster_infra_volume_groups }}"
when: gluster_infra_volume_groups is defined
failed_when: False
- name: Remove Cache PV
shell: pvremove {{ item.cachedisk }} -ff
register: shell_output
changed_when: shell_output.rc == 0
with_items: "{{ gluster_infra_cache_vars }}"
when: gluster_infra_cache_vars is defined
failed_when: False
# Remove vdo devices if any
- name: Remove VDO devices
vdo:
name: "{{ item.name }}"
state: absent
with_items: "{{ gluster_infra_vdo }}"
when: gluster_infra_vdo is defined
tags:
- cleanup_bricks