Initial project commit
This commit is contained in:
58
lvol-testing.yml
Normal file
58
lvol-testing.yml
Normal file
@ -0,0 +1,58 @@
|
||||
---
|
||||
- name: LVOL Testing
|
||||
hosts: bigboot
|
||||
gather_facts: true
|
||||
|
||||
vars:
|
||||
check_vg: system
|
||||
check_lv: root
|
||||
check_pv: sda2
|
||||
|
||||
tasks:
|
||||
# - name: Gather LVM facts
|
||||
# community.general.lvol:
|
||||
# vg: "{{ check_vg }}"
|
||||
# lv: "{{ check_lv }}"
|
||||
# register: lvm_info
|
||||
|
||||
# - name: Check if LVM spans multiple segments
|
||||
# ansible.builtin.debug:
|
||||
# var: lvm_info
|
||||
# msg: >
|
||||
# The logical volume spans multiple segments:
|
||||
# {{ lvm_info.logical_volumes[0].segments | length > 1 }}
|
||||
|
||||
- name: Run lvdisplay command
|
||||
ansible.builtin.command: "lvdisplay -m /dev/{{ check_vg }}/{{ check_lv }}"
|
||||
register: lvdisplay_output
|
||||
|
||||
- name: Run pvdisplay command
|
||||
ansible.builtin.command: "pvdisplay -m /dev/{{ check_pv }}"
|
||||
register: pvdisplay_output
|
||||
|
||||
- name: Debug lvdisplay_output.stdout
|
||||
ansible.builtin.debug:
|
||||
var: lvdisplay_output.stdout
|
||||
|
||||
# Logical extents 0 to 8488:
|
||||
- name: Parse lvdisplay output
|
||||
ansible.builtin.set_fact:
|
||||
lv_segments: "{{ lvdisplay_output.stdout | regex_findall('Logical extents [0-9]+ to [0-9]+') }}"
|
||||
|
||||
- name: Debug pvdisplay_output.stdout
|
||||
ansible.builtin.debug:
|
||||
var: pvdisplay_output.stdout
|
||||
|
||||
# Physical extent 9001 to 9256:
|
||||
- name: Parse pvdisplay output
|
||||
ansible.builtin.set_fact:
|
||||
pv_segments: "{{ pvdisplay_output.stdout | regex_findall('Physical extent [0-9]+ to [0-9]+') }}"
|
||||
|
||||
- name: Check if LVM spans multiple segments
|
||||
ansible.builtin.debug:
|
||||
msg: >
|
||||
The logical volume spans multiple segments:
|
||||
{{ lv_segments }}
|
||||
{{ pv_segments }}
|
||||
|
||||
# {{ segments | length > 1 }}
|
||||
Reference in New Issue
Block a user