summaryrefslogtreecommitdiff
path: root/roles/storage/lvm/volume/tasks/main.yml
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-01-20 22:42:30 +0100
committerChristian Pointner <equinox@spreadspace.org>2024-01-20 22:42:30 +0100
commitba2ab1cb42db29c8287c65a3f1e0b646eeba0464 (patch)
tree73a496d6b03085de2aa8dfe22ca201ff0354ba07 /roles/storage/lvm/volume/tasks/main.yml
parentapps/storage: test with zfs volumes (diff)
add storage_device roles
Diffstat (limited to 'roles/storage/lvm/volume/tasks/main.yml')
-rw-r--r--roles/storage/lvm/volume/tasks/main.yml53
1 files changed, 22 insertions, 31 deletions
diff --git a/roles/storage/lvm/volume/tasks/main.yml b/roles/storage/lvm/volume/tasks/main.yml
index 9329965c..d7255739 100644
--- a/roles/storage/lvm/volume/tasks/main.yml
+++ b/roles/storage/lvm/volume/tasks/main.yml
@@ -6,42 +6,33 @@
that:
- (lvm_volume.parent.thinpool | default(false))
-- name: install thin-provisioning-tools
- when: (lvm_volume.thinpool | default(false))
- apt:
- name: thin-provisioning-tools
- state: present
-
- name: create logical volume
lvol:
vg: "{{ lvm_volume.parent.vg | default(lvm_volume.vg) }}"
- lv: "{{ (lvm_volume.thinpool | default(false)) | ternary(omit, lvm_volume.lv) }}"
+ lv: "{{ lvm_volume.lv }}"
size: "{{ lvm_volume.size }}"
- thinpool: "{{ (lvm_volume.thinpool | default(false)) | ternary(lvm_volume.lv, (lvm_volume.parent.lv | default(omit))) }}"
+ thinpool: "{{ lvm_volume.parent.lv | default(omit) }}"
-- name: create and mount filesystem
- when: not (lvm_volume.thinpool | default(false))
- block:
- - name: create filesystem
- filesystem:
- fstype: "{{ lvm_volume.fs }}"
- dev: "/dev/mapper/{{ lvm_volume.parent.vg | default(lvm_volume.vg) | replace('-', '--') }}-{{ lvm_volume.lv | replace('-', '--') }}"
+- name: create filesystem
+ filesystem:
+ fstype: "{{ lvm_volume.fs }}"
+ dev: "/dev/mapper/{{ lvm_volume.parent.vg | default(lvm_volume.vg) | replace('-', '--') }}-{{ lvm_volume.lv | replace('-', '--') }}"
- - name: mount filesytem
- mount:
- src: "/dev/mapper/{{ lvm_volume.parent.vg | default(lvm_volume.vg) | replace('-', '--') }}-{{ lvm_volume.lv | replace('-', '--') }}"
- path: "{{ lvm_volume.dest }}"
- fstype: "{{ lvm_volume.fs }}"
- state: mounted
+- name: mount filesytem
+ mount:
+ src: "/dev/mapper/{{ lvm_volume.parent.vg | default(lvm_volume.vg) | replace('-', '--') }}-{{ lvm_volume.lv | replace('-', '--') }}"
+ path: "{{ lvm_volume.dest }}"
+ fstype: "{{ lvm_volume.fs }}"
+ state: mounted
- - name: set volume owner/group and mode
- file:
- state: directory
- path: "{{ lvm_volume.dest }}"
- mode: "{{ lvm_volume.mode | default(omit) }}"
- owner: "{{ lvm_volume.owner | default(omit) }}"
- group: "{{ lvm_volume.group | default(omit) }}"
+- name: set volume owner/group and mode
+ file:
+ state: directory
+ path: "{{ lvm_volume.dest }}"
+ mode: "{{ lvm_volume.mode | default(omit) }}"
+ owner: "{{ lvm_volume.owner | default(omit) }}"
+ group: "{{ lvm_volume.group | default(omit) }}"
- - name: export volume mountpoint
- set_fact:
- storage_volume_mountpoint: "{{ lvm_volume.dest }}"
+- name: export volume mountpoint
+ set_fact:
+ storage_volume_mountpoint: "{{ lvm_volume.dest }}"