29 lines
970 B
YAML
29 lines
970 B
YAML
---
|
|
- name: LVOL Testing
|
|
hosts: bigboot
|
|
gather_facts: true
|
|
|
|
vars:
|
|
check_vg: system
|
|
check_lv: root
|
|
check_pv: sda2
|
|
|
|
tasks:
|
|
- name: Run pvdisplay command
|
|
ansible.builtin.command: "pvdisplay -m /dev/{{ check_pv }}"
|
|
register: pvdisplay_output
|
|
|
|
- name: Parse pvdisplay output for free extents
|
|
ansible.builtin.set_fact:
|
|
free_extents: "{{ pvdisplay_output.stdout | regex_findall('Physical extent [0-9]+ to [0-9]+:\\s+FREE') }}"
|
|
|
|
- name: Parse pvdisplay output for root logical volume extents
|
|
ansible.builtin.set_fact:
|
|
root_extents: "{{ pvdisplay_output.stdout | regex_findall('Physical extent [0-9]+ to [0-9]+:\\s+Logical volume\\s+/dev/system/root') }}"
|
|
|
|
- name: Check if root logical volume is broken up by free extents
|
|
ansible.builtin.debug:
|
|
msg: >
|
|
The root logical volume is broken up by free extents:
|
|
{{ free_extents | length > 0 and root_extents | length > 1 }}
|