ansible.builtin.lvg (v2.9.27) — module

Configure LVM volume groups

| "added in version" 1.1 of ansible.builtin"

Authors: Alexander Bulimov (@abulimov)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

This module creates, removes or resizes volume groups.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a volume group on top of /dev/sda1 with physical extent size = 32MB
  lvg:
    vg: vg.services
    pvs: /dev/sda1
    pesize: 32
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a volume group on top of /dev/sdb with physical extent size = 128KiB
  lvg:
    vg: vg.services
    pvs: /dev/sdb
    pesize: 128K
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a volume group with name vg.services
  lvg:
    vg: vg.services
    state: absent

Inputs

    
vg:
    description:
    - The name of the volume group.
    required: true
    type: str

pvs:
    description:
    - 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.
    type: list

force:
    default: false
    description:
    - If C(yes), allows to remove volume group with logical volumes.
    type: bool

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Control if the volume group exists.
    type: str

pesize:
    default: '4'
    description:
    - The size of the physical extent. I(pesize) must be a power of 2 of at least 1 sector
      (where the sector size is the largest sector size of the PVs currently used in the
      VG), or at least 128KiB.
    - Since Ansible 2.6, pesize can be optionally suffixed by a UNIT (k/K/m/M/g/G), default
      unit is megabyte.
    type: str

pv_options:
    description:
    - Additional options to pass to C(pvcreate) when creating the volume group.
    type: str
    version_added: '2.4'
    version_added_collection: ansible.builtin

vg_options:
    description:
    - Additional options to pass to C(vgcreate) when creating the volume group.
    type: str
    version_added: '1.6'
    version_added_collection: ansible.builtin

See also