2018-07-05 00:15:05 +00:00
|
|
|
---
|
|
|
|
- name: "Install lvm utils (RedHat)"
|
|
|
|
become: true
|
2021-06-05 11:16:39 +00:00
|
|
|
package:
|
2019-04-01 09:38:33 +00:00
|
|
|
name: "lvm2"
|
|
|
|
state: "present"
|
2018-07-05 00:15:05 +00:00
|
|
|
when: "ansible_os_family == 'RedHat'"
|
|
|
|
|
|
|
|
- name: "Install lvm utils (Debian)"
|
|
|
|
become: true
|
|
|
|
apt:
|
2019-04-01 09:38:33 +00:00
|
|
|
name: "lvm2"
|
|
|
|
state: "present"
|
2018-07-05 00:15:05 +00:00
|
|
|
when: "ansible_os_family == 'Debian'"
|
2018-07-27 15:33:43 +00:00
|
|
|
|
2018-07-05 00:15:05 +00:00
|
|
|
- name: "Get volume group information."
|
2019-08-01 11:00:16 +00:00
|
|
|
environment:
|
|
|
|
PATH: "{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH / CentOS conservative path management
|
2018-07-05 00:15:05 +00:00
|
|
|
become: true
|
2018-07-27 15:33:43 +00:00
|
|
|
shell: "pvs {{ disk_volume_device_1 }} --option vg_name | tail -n+2"
|
2018-07-05 00:15:05 +00:00
|
|
|
register: "volume_groups"
|
2021-07-12 07:00:47 +00:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2018-07-05 00:15:05 +00:00
|
|
|
changed_when: false
|
2018-07-27 15:33:43 +00:00
|
|
|
|
2020-07-27 13:24:17 +00:00
|
|
|
- name: "Remove volume groups." # noqa 301
|
2019-08-01 11:00:16 +00:00
|
|
|
environment:
|
|
|
|
PATH: "{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH / CentOS conservative path management
|
2018-07-05 00:15:05 +00:00
|
|
|
become: true
|
|
|
|
command: "vgremove {{ volume_group }} --yes"
|
|
|
|
with_items: "{{ volume_groups.stdout_lines }}"
|
|
|
|
loop_control: { loop_var: "volume_group" }
|
2018-07-27 15:33:43 +00:00
|
|
|
|
2020-07-27 13:24:17 +00:00
|
|
|
- name: "Remove physical volume from cluster disks." # noqa 301
|
2019-08-01 11:00:16 +00:00
|
|
|
environment:
|
|
|
|
PATH: "{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH / CentOS conservative path management
|
2018-07-05 00:15:05 +00:00
|
|
|
become: true
|
2018-07-27 15:33:43 +00:00
|
|
|
command: "pvremove {{ disk_volume_device_1 }} --yes"
|
2021-07-12 07:00:47 +00:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2018-07-27 15:33:43 +00:00
|
|
|
|
2018-07-05 00:15:05 +00:00
|
|
|
- name: "Remove lvm utils (RedHat)"
|
|
|
|
become: true
|
2021-06-05 11:16:39 +00:00
|
|
|
package:
|
2019-04-01 09:38:33 +00:00
|
|
|
name: "lvm2"
|
|
|
|
state: "absent"
|
2019-08-01 11:00:16 +00:00
|
|
|
when: "ansible_os_family == 'RedHat' and heketi_remove_lvm"
|
2018-07-05 00:15:05 +00:00
|
|
|
|
|
|
|
- name: "Remove lvm utils (Debian)"
|
|
|
|
become: true
|
|
|
|
apt:
|
2019-04-01 09:38:33 +00:00
|
|
|
name: "lvm2"
|
|
|
|
state: "absent"
|
2019-08-01 11:00:16 +00:00
|
|
|
when: "ansible_os_family == 'Debian' and heketi_remove_lvm"
|