mk-ansible-roles.disk-init
disk-init
This role is used to add new disks to LVM Groups (Logical Volume Management). It is designed to avoid adding the same disk multiple times. However, it doesn't remove disks from a disk group or clean up disks that already have a valid LVM signature (made by the command pvcreate
).
Requirements
It has been tested on RHEL EL7 but should work on CentOS 6, 7, EL7, and Fedora. The system needs to be properly subscribed to install the necessary disk management packages (gdisk, sg3_utils, lvm2).
Role Variables
To set up disks on a system, you need to define the following variables in your playbook:
disks:
<devicepath1> : <volumegroup>
<devicepath2> : <volumegroup>
...
logvols:
<logical_volume_name1>:
size: <size>
vol: <volumegroup>
mountpoint: <mountpoint>
pvs: <devicepath> (optional, if you want to specify the location of the volume)
fstype: xfs (optional, defaults to xfs)
opts: -b 4096 (optional parameters for mounting)
<logical_volume_name2>:
size: <size>
vol: <volumegroup>
mountpoint: <mountpoint>
pvs: <devicepath> (optional, if you want to specify the location of the volume)
fstype: xfs (optional, defaults to xfs)
opts: -b 4096 (optional parameters for mounting)
....
Example Playbook
This is an example playbook that adds two disks to the volume group vg00
and adds another one to the existing root volume group:
- hosts: servers
remote_user: root
vars:
disks:
/dev/vdc: vg00
/dev/vdb: vg00
/dev/vdd: root_vg
logvols:
hana_shared:
size: 24G
vol: vg00
mountpoint: /hana/shared
hana_data:
size: 24G
vol: vg00
mountpoint: /hana/data
hana_logs:
size: 12G
vol: vg00
mountpoint: /hana/logs
pvs: /dev/vdc
usr_sap:
size: 49G
vol: vg00
mountpoint: /usr/sap
fstype: xfs
opts: -b4096
install:
size: 100G
vol: root_vg
mountpoint: /install
fstype: ext4
roles:
- { role: mk-ansible-roles.disk-init }
License
Apache License Version 2.0, January 2004
Author Information
Markus Koch
Please leave comments in the GitHub repo issue list.
ansible-galaxy install mk-ansible-roles.disk-init