HanXHX.lvm

LVM Ansible Role

This is a tool to manage LVM (Logical Volume Management) Groups and Volumes. You can use it to create, expand, or change the size of LVM Groups and volumes.

Requirements

Before using this role, make sure to identify the devices or disks that will be part of the LVM setup. Choose the right devices carefully.

Role Variables

lvm_groups is a list of volume groups (vgs).

Volume Groups (vgs)

  • vgname: a unique name for the group.
  • disks: specify disks or partitions to add to the group (separate them with commas).
  • create: set to true to create the group, or false to delete it.
  • lvnames: a list of logical volumes (see below).

Logical Volumes (lvnames)

  • lvname: a unique name for the volume.
  • size: specify the size of the volume (e.g., "10G" for 10 gigabytes, "512M" for 512 megabytes).
  • create: set to true if the volume should exist, or false if it should be removed.
  • filesystem: specify the filesystem type for the volume.
  • mount: set to true if the filesystem should be mounted.
  • mount_point: specify where to mount the filesystem.
  • mount_options: specify mount options (separate them with commas).

Dependencies

None

Example Playbook

Here’s an example of how to use the role in a playbook:

- hosts: servers
  vars:
    lvm_apply: true
    lvm_groups:
      - vgname: misc-vg
        disks: /dev/sda5,/dev/sdc,/dev/sdd
        create: true
        lvnames:
          - lvname: swap_1
            size: 5g
            create: true
            filesystem:
            mount: false
          - lvname: mysql
            size: 40g
            create: true
            filesystem: ext4
            mount: true
            mount_point: /var/lib/mysql
            mount_options: 'defaults,noatime'
      - vgname: test-vg
        disks: /dev/sdb
        create: true
        lvnames: []

  roles:
     - HanXHX.lvm

License

This code is under the BSD license.

Donation

If this code has helped you or you’ve used it for your projects, feel free to buy me a drink! 🍻

  • Bitcoin: 1BQwhBeszzWbUTyK4aUyq3SRg7rBSHcEQn
  • Ethereum: 63abe6b2648fd892816d87a31e3d9d4365a737b5
  • Litecoin: LeNDw34zQLX84VvhCGADNvHMEgb5QyFXyD
  • Monero: 45wbf7VdQAZS5EWUrPhen7Wo4hy7Pa7c7ZBdaWQSRowtd3CZ5vpVw5nTPphTuqVQrnYZC72FXDYyfP31uJmfSQ6qRXFy3bQ

No cryptocurrency? ⭐ You can also show appreciation for the project! 😎

Author Information

Informazioni sul progetto

Role to manage LVM Groups/Logical Volumes. Can be used to create, extend or resize LVM.

Installa
ansible-galaxy install HanXHX.lvm
Licenza
bsd-2-clause
Download
6.7k
Proprietario
CEO/CTO/SRE triplestack.fr / daemonit.com