lvg - Configure LVM volume groups

Synopsis

Parameters

Parameter Choices/Defaults Comments
force
bool
    Choices:
  • no ←
  • yes
If yes, allows to remove volume group with logical volumes.
pesize Default:
4
The size of the physical extent. pesize must be a power of 2, or multiple of 128KiB. Since version 2.6, pesize can be optionally suffixed by a UNIT (k/K/m/M/g/G), default unit is megabyte.
pv_options
(added in 2.4)
Additional options to pass to pvcreate when creating the volume group.
pvs
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.
state
    Choices:
  • absent
  • present ←
Control if the volume group exists.
vg
required
The name of the volume group.
vg_options
(added in 1.6)
Additional options to pass to vgcreate when creating the volume group.

Notes

Note

  • This module does not modify PE size for already present volume group.

Examples

- name: Create a volume group on top of /dev/sda1 with physical extent size = 32MB
  lvg:
    vg: vg.services
    pvs: /dev/sda1
    pesize: 32

- name: Create a volume group on top of /dev/sdb with physical extent size = 128KiB
  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.
  lvg:
    vg: vg.services
    pvs: /dev/sdb1,/dev/sdc5

- name: Remove a volume group with name vg.services
  lvg:
    vg: vg.services
    state: absent

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Alexander Bulimov (@abulimov)

Hint

If you notice any issues in this documentation you can edit this document to improve it.