datavol: Add support for LVM
The `datavol.yml` playbook can now create LVM volume groups and logical volumes. This will be useful for physical hosts with static storage. LVM LVs and VGs are defined using the `logical_volumes` Ansible variable, which contains a mapping of VG names to their properties. Each VG must have two properties: `pvs`, which is a list of LVM physical volumes to add to the VG, and `lvs`, a list of LVs and their properties, including `name` and `size. For example: ```yaml logical_volumes: kubernetes: pvs: - /dev/nvme0n1 lvs: - name: containers size: 64G - name: kubelet size: 32G ```unifi-restore
parent
dc924aa70b
commit
93553c7630
22
datavol.yml
22
datavol.yml
|
@ -21,6 +21,28 @@
|
|||
tags:
|
||||
- install
|
||||
|
||||
- name: ensure lvm volume groups exist
|
||||
lvg:
|
||||
vg: '{{ item.key }}'
|
||||
pvs: '{{ item.value.pvs }}'
|
||||
loop: '{{ logical_volumes | d({}) | dict2items }}'
|
||||
loop_control:
|
||||
label: '{{ item.key }}'
|
||||
tags:
|
||||
- lvm
|
||||
- lvm-vg
|
||||
- name: ensure lvm logical volumes exist
|
||||
lvol:
|
||||
lv: '{{ item.1.name }}'
|
||||
vg: '{{ item.0.key }}'
|
||||
size: '{{ item.1.size }}'
|
||||
loop: '{{ logical_volumes | dict2items | subelements("value.lvs") }}'
|
||||
loop_control:
|
||||
label: '{{ item.0.key }}/{{ item.1.name }}'
|
||||
tags:
|
||||
- lvm
|
||||
- lvm-lv
|
||||
|
||||
- name: ensure data volume filesystem exists
|
||||
filesystem:
|
||||
dev: '{{ item.dev }}'
|
||||
|
|
Loading…
Reference in New Issue