Skip to content

linuxfabrik.lfops.lvm_pv

Manage LVM Physical Volumes

Synopsis

  • Creates, resizes or removes LVM Physical Volumes.

Available since LFOps 6.0.0.

Mandatory Parameters

device

  • Path to the block device to manage.
  • Type: Path.

Optional Parameters

force

  • Force the operation. When state=present (creating a PV), this uses pvcreate -f to force creation. When state=absent (removing a PV), this uses pvremove -ff to force removal even if part of a volume group.
  • Type: Bool.
  • Default: false

resize

  • Resize PV to device size when state=present.
  • Type: Bool.
  • Default: false

state

  • Control if the physical volume exists.
  • Type: String. One of present, absent.
  • Default: present

Examples

- name: Creating physical volume on /dev/sdb
  linuxfabrik.lfops.lvm_pv:
    device: /dev/sdb

- name: Creating and resizing (if needed) physical volume
  linuxfabrik.lfops.lvm_pv:
    device: /dev/sdb
    resize: true

- name: Removing physical volume that is not part of any volume group
  linuxfabrik.lfops.lvm_pv:
    device: /dev/sdb
    state: absent

- name: Force removing physical volume that is already part of a volume group
  linuxfabrik.lfops.lvm_pv:
    device: /dev/sdb
    force: true
    state: absent

Notes

  • Requires LVM2 utilities installed on the target system.
  • Device path must exist when creating a PV.

Authors

  • Klention Mali (@klention)