Hi, i’m looking to add a step that checks and prints the current sizes of existing lv’s in a volume group before expanding them. Currently, I have a play that will extend the size of multiple lvm’s assuming the vg has enough space. I’m not sure whats the best way to determine the current sizes of the existing lvms. My first thought is to maybe create a role that uses the shell command that then runs vgs and lvs to capture and print current size and free space of lv’s and vg but not sure if thats the best way. Here is my current code:
- name: Extend the logical volume to take all remaining space of the PVs and resize the underlying filesystem
vars:
lvextendAudit: False
lvextendAuditSize: 4096
#lvextendAuditSize: 4096
##------------------------
lvextendOpt: True
lvextendOptSize: 40g
#lvextendOptSize: 5120
block:- name: Extend the Audit Logical Volume
lvol:
vg: rhel
lv: audit
size: ‘{{ lvextendAuditSize }}’
resizefs: true
shrink: no
when: lvextendAudit - name: Extend the OPT Logical Volume
lvol:
vg: rhel
lv: opt
size: ‘{{ lvextendOptSize }}’
resizefs: true
shrink: no
when: lvextendOpt
…
- name: Extend the Audit Logical Volume