summaryrefslogtreecommitdiff
path: root/roles/vm/install/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/vm/install/tasks')
-rw-r--r--roles/vm/install/tasks/main.yml23
1 files changed, 15 insertions, 8 deletions
diff --git a/roles/vm/install/tasks/main.yml b/roles/vm/install/tasks/main.yml
index 50772e53..4fa673c5 100644
--- a/roles/vm/install/tasks/main.yml
+++ b/roles/vm/install/tasks/main.yml
@@ -1,22 +1,29 @@
---
- name: create lvm-based disks for vm
- loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items }}"
+ loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'lvm') | list }}"
loop_control:
- label: "{% if item.value.type == 'lvm' %}{{ item.value.vg }} / {{ item.value.lv }} ({{ item.value.size }}){% else %}unused{% endif %}"
- when: item.value.type == 'lvm'
+ label: "{{ item.value.vg }} / {{ item.value.lv }} ({{ item.value.size }})"
lvol:
vg: "{{ item.value.vg }}"
lv: "{{ item.value.lv }}"
size: "{{ item.value.size }}"
state: present
-- name: create zfs-based disks for vm
- loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items }}"
+- name: create zfs base datasets for vm
+ loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'zfs') | map(attribute='value.backend') | map('default', 'default') | unique | list }}"
+ zfs:
+ name: "{{ vm_host.zfs[item].pool }}/{{ vm_host.zfs[item].name }}/{{ install_hostname }}"
+ state: present
+ extra_zfs_properties:
+ canmount: no
+ mountpoint: none
+
+- name: create zfs-based disk volumes for vm
+ loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'zfs') | list }}"
loop_control:
- label: "{% if item.value.type == 'zfs' %}{{ item.value.pool }} / {{ item.value.name }} ({{ item.value.size }}){% else %}unused{% endif %}"
- when: item.value.type == 'zfs'
+ label: "{{ item.value.name }} on backend {{ item.value.backend | default('default') }} ({{ item.value.size }})"
zfs:
- name: "{{ item.value.pool }}/{{ item.value.name }}"
+ name: "{{ vm_host.zfs[item.value.backend | default('default')].pool }}/{{ vm_host.zfs[item.value.backend | default('default')].name }}/{{ install_hostname }}/{{ item.value.name }}"
state: present
extra_zfs_properties:
volsize: "{{ item.value.size }}"