summaryrefslogtreecommitdiffstats
path: root/roles/pve-storage/tasks
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-07-03 23:43:17 +0200
committerAhmed Abdelhalim <[email protected]>2026-07-03 23:44:47 +0200
commit97c97e7b9880a90b2e54dd2b5f02aaf65824fb1f (patch)
treed0f0086ead57a6e798aac3038298cc557c30c6cd /roles/pve-storage/tasks
parent005c49353a6a71954e6a975a43989ded1786022a (diff)
Refactor pve roles to create storage separately
Diffstat (limited to 'roles/pve-storage/tasks')
-rw-r--r--roles/pve-storage/tasks/main.yml31
1 files changed, 31 insertions, 0 deletions
diff --git a/roles/pve-storage/tasks/main.yml b/roles/pve-storage/tasks/main.yml
new file mode 100644
index 00000000..7fb66b87
--- /dev/null
+++ b/roles/pve-storage/tasks/main.yml
@@ -0,0 +1,31 @@
+---
+- name: "Create LVM volume group for PVE storage"
+ become: true
+ community.general.lvg:
+ vg: "{{ pve_storage_name }}"
+ pvs: "{{ pve_storage_device }}"
+ state: present
+ tags:
+ - "molecule-notest"
+
+- name: "Create LVM thin pool for PVE storage"
+ become: true
+ community.general.lvol:
+ vg: "{{ pve_storage_name }}"
+ lv: "{{ pve_storage_pool }}"
+ size: "100%FREE"
+ opts: "--type thin-pool"
+ shrink: false
+ state: present
+ tags:
+ - "molecule-notest"
+
+- name: "Register local-lvm storage in PVE"
+ become: true
+ ansible.builtin.command:
+ cmd: "pvesm add lvmthin local-lvm --vgname {{ pve_storage_name }} --thinpool {{ pve_storage_pool }}"
+ register: pve_pvesm_add
+ changed_when: pve_pvesm_add.rc == 0
+ failed_when: pve_pvesm_add.rc != 0 and 'already defined' not in pve_pvesm_add.stderr
+ tags:
+ - "molecule-notest"