summaryrefslogtreecommitdiff
path: root/roles/vm/host/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/vm/host/tasks')
-rw-r--r--roles/vm/host/tasks/main.yml6
-rw-r--r--roles/vm/host/tasks/network.yml1
-rw-r--r--roles/vm/host/tasks/zfs.yml12
3 files changed, 18 insertions, 1 deletions
diff --git a/roles/vm/host/tasks/main.yml b/roles/vm/host/tasks/main.yml
index 0e11da3d..390016a2 100644
--- a/roles/vm/host/tasks/main.yml
+++ b/roles/vm/host/tasks/main.yml
@@ -19,9 +19,13 @@
notify: restart haveged
- name: install vm-host network
- when: vm_host.network is defined
+ when: "'network' in vm_host"
include_tasks: network.yml
+- name: prepare zfs volumes
+ when: "'zfs' in vm_host"
+ include_tasks: zfs.yml
+
- name: create lvm-based disk for installers
when: installer_lvm is defined
block:
diff --git a/roles/vm/host/tasks/network.yml b/roles/vm/host/tasks/network.yml
index bc207805..0688ec42 100644
--- a/roles/vm/host/tasks/network.yml
+++ b/roles/vm/host/tasks/network.yml
@@ -69,3 +69,4 @@
label: "br-{{ item.item.key }}"
when: item is changed
command: "/sbin/ifup br-{{ item.item.key }}"
+ failed_when: false
diff --git a/roles/vm/host/tasks/zfs.yml b/roles/vm/host/tasks/zfs.yml
new file mode 100644
index 00000000..00de48a9
--- /dev/null
+++ b/roles/vm/host/tasks/zfs.yml
@@ -0,0 +1,12 @@
+---
+- name: create zfs base datasets
+ loop: "{{ lookup('dict', vm_host.zfs, wantlist=True) }}"
+ loop_control:
+ label: "{{ item.key }} -> {{ item.value.pool }}/{{ item.value.name }}{% if 'quota' in item.value %}={{ item.value.quota }}{% endif %}"
+ zfs:
+ name: "{{ item.value.pool }}/{{ item.value.name }}"
+ state: present
+ extra_zfs_properties:
+ quota: "{{ item.value.quota | default(omit) }}"
+ canmount: no
+ mountpoint: none