A modular Ansible collection for declarative LVM-based storage provisioning on Linux hosts.
This collection provides reusable roles and filter plugins for validating and creating disk partitions, physical volumes (PVs), volume groups (VGs), and logical volumes (LVs). It is designed to support structured and idempotent automation for real-world environments.
| Role | Purpose |
|---|---|
process_disks |
Validates and creates partitions using parted |
process_lvm |
Validates and sets up PVs and volume groups |
process_volumes |
Creates logical volumes, formats them, and mounts |
This collection includes filter plugins for validating input and planning storage operations:
validate_partitions,partition_path,partition_pathsvalidate_lvm_partition,validate_pvs,validate_vg,validate_volume,validate_mount- Utility filters:
to_mib,mib
Located in playbooks/setup_storage.yml
- name: Create LVM setup on host
hosts: all
become: true
vars:
debug_mode: false
roles:
- aursu.lvm_setup.process_disks
- aursu.lvm_setup.process_lvm
- aursu.lvm_setup.process_volumespartitions:
/dev/sda:
- num: 6
/dev/sdb:
- num: 6
vg_name: data
volumes:
- name: data1
vg: data
size: 200g
filesystem: xfs
mountpoint: /mnt/disks/data1
- name: data2
vg: data
size: 200g
filesystem: xfs
mountpoint: /mnt/disks/data2- Python 3.8+
- Ansible 2.14+
community.generalcollection (forpartedmodule)
Install dependency manually (if needed):
ansible-galaxy collection install community.generalUnit tests are located in:
tests/unit/plugins/filter/
Run tests with:
PYTHONPATH=. pytest tests/unit/plugins/filter/