homeserver/roles/mrlesmithjr.ansible-manage-lvm/tasks/manage_lvm.yml

32 lines
763 B
YAML
Raw Normal View History

---
- name: manage_lvm | manage physical volume group creation
include_tasks: create_vg.yml
loop: "{{ lvm_groups }}"
loop_control:
loop_var: vg
- name: manage_lvm | Removing LVM logical volume(s)
lvol:
vg: "{{ item.0.vgname }}"
lv: "{{ item.1.lvname }}"
state: absent
force: true
become: true
loop: "{{ lvm_groups|subelements('lvnames', {'skip_missing': true}) }}"
when:
- item.1 is defined
- item.1 != 'None'
- item.1.create is defined
- not item.1.create|bool
- name: manage_lvm | Removing LVM volume group(s)
lvg:
vg: "{{ item.vgname }}"
pvs: "{{ item.disks | join(',') }}"
state: absent
become: true
loop: "{{ lvm_groups }}"
when:
- item.create is defined
- not item.create|bool