This playbook helps you create partitions, physical volumes, volume groups, logical volumes, and extend existing partitions to a volume group
- Ansible: Ensure Ansible is installed on your control machine.
- Logical Volume Manager version 2 (LVM2): Install it on target systems. You can install it using
apt
:
sudo apt update
sudo apt install lvm2
- Update the variables in the files volume_group_init.yml and volume_group_extend.yml to match your environment.
- Create an inventory file specifying the target hosts.Create an inventory file.
devices
: A list of disks to be partitioned.vg_name
: The name of the volume group.lv_name
: The name of the logical.mount_point
: The path where the logical volume will be mounted.
Run the following command to create a new volume group:
ansible-playbook volume_group_init.yml -i your_inventory.ini
Run the following command to extend an existing volume group:
ansible-playbook volume_group_extend.yml -i your_inventory.ini