community.general.lvg module – Configure LVM volume groups
Note
This module is part of the community.general collection (version 9.4.0).
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.lvg
.
Synopsis
This module creates, removes or resizes volume groups.
Parameters
Parameter |
Comments |
---|---|
If Choices:
|
|
Additional options to pass to Default: |
|
If Choices:
|
|
List of comma-separated devices to use as physical devices in this volume group. Required when creating or resizing volume group. The module will take care of running pvcreate if needed. |
|
Whether the volume group’s physical volumes’ UUIDs are regenerated. This is not idempotent. Specifying this parameter always results in a change. Choices:
|
|
Whether the volume group’s UUID is regenerated. This is not idempotent. Specifying this parameter always results in a change. Choices:
|
|
Control if the volume group exists and it’s state. The states If Choices:
|
|
The name of the volume group. |
|
Additional options to pass to Default: |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Notes
Note
This module does not modify PE size for already present volume group.
See Also
See also
- community.general.filesystem
Makes a filesystem.
- community.general.lvol
Configure LVM logical volumes.
- community.general.parted
Configure block device partitions.
Examples
- name: Create a volume group on top of /dev/sda1 with physical extent size = 32MB
community.general.lvg:
vg: vg.services
pvs: /dev/sda1
pesize: 32
- name: Create a volume group on top of /dev/sdb with physical extent size = 128KiB
community.general.lvg:
vg: vg.services
pvs: /dev/sdb
pesize: 128K
# If, for example, we already have VG vg.services on top of /dev/sdb1,
# this VG will be extended by /dev/sdc5. Or if vg.services was created on
# top of /dev/sda5, we first extend it with /dev/sdb1 and /dev/sdc5,
# and then reduce by /dev/sda5.
- name: Create or resize a volume group on top of /dev/sdb1 and /dev/sdc5.
community.general.lvg:
vg: vg.services
pvs: /dev/sdb1,/dev/sdc5
- name: Remove a volume group with name vg.services
community.general.lvg:
vg: vg.services
state: absent
- name: Create a volume group on top of /dev/sda3 and resize the volume group /dev/sda3 to the maximum possible
community.general.lvg:
vg: resizableVG
pvs: /dev/sda3
pvresize: true
- name: Deactivate a volume group
community.general.lvg:
state: inactive
vg: vg.services
- name: Activate a volume group
community.general.lvg:
state: active
vg: vg.services
- name: Reset a volume group UUID
community.general.lvg:
state: inactive
vg: vg.services
reset_vg_uuid: true
- name: Reset both volume group and pv UUID
community.general.lvg:
state: inactive
vg: vg.services
pvs: /dev/sdb1,/dev/sdc5
reset_vg_uuid: true
reset_pv_uuid: true