community.general.lvm_pv module – Manage LVM Physical Volumes
Note
This module is part of the community.general collection (version 12.6.1).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.lvm_pv.
New in community.general 11.0.0
Synopsis
- Creates, resizes or removes LVM Physical Volumes.
Parameters
Parameter | Comments |
|---|---|
device path / required | Path to the block device to manage. |
force boolean | Force the operation. When When Choices:
|
resize boolean | |
state string | Control if the physical volume exists. Choices:
|
Notes
Note
- Requires LVM2 utilities installed on the target system.
- Device path must exist when creating a PV.
Examples
- name: Creating physical volume on /dev/sdb
community.general.lvm_pv:
device: /dev/sdb
- name: Creating and resizing (if needed) physical volume
community.general.lvm_pv:
device: /dev/sdb
resize: true
- name: Removing physical volume that is not part of any volume group
community.general.lvm_pv:
device: /dev/sdb
state: absent
- name: Force removing physical volume that is already part of a volume group
community.general.lvm_pv:
device: /dev/sdb
force: true
state: absent
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/community/general/lvm_pv_module.html