summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/zfs/base/defaults/main.yml9
-rw-r--r--roles/zfs/base/tasks/enable-systemd-mount-generator.yml23
-rw-r--r--roles/zfs/base/tasks/main.yml22
3 files changed, 31 insertions, 23 deletions
diff --git a/roles/zfs/base/defaults/main.yml b/roles/zfs/base/defaults/main.yml
index f3dfbce9..c275b981 100644
--- a/roles/zfs/base/defaults/main.yml
+++ b/roles/zfs/base/defaults/main.yml
@@ -1,4 +1,9 @@
---
+zfs_use_systemd_mount_generator: yes
+#zfs_arc_size:
+# min: {{ 2 * 1024 * 1024 * 1024 }}
+# max: {{ 8 * 1024 * 1024 * 1024 }}
+
zfs_zpool_properties:
ashift: 12
@@ -12,7 +17,3 @@ zfs_zpool_properties:
# properties:
# ashift: 12
# prop: value
-
-#zfs_arc_size:
-# min: {{ 2 * 1024 * 1024 * 1024 }}
-# max: {{ 8 * 1024 * 1024 * 1024 }}
diff --git a/roles/zfs/base/tasks/enable-systemd-mount-generator.yml b/roles/zfs/base/tasks/enable-systemd-mount-generator.yml
new file mode 100644
index 00000000..abefbeb1
--- /dev/null
+++ b/roles/zfs/base/tasks/enable-systemd-mount-generator.yml
@@ -0,0 +1,23 @@
+---
+- name: enable zfs-list-cacher zlet
+ file:
+ src: /usr/lib/zfs-linux/zed.d/history_event-zfs-list-cacher.sh
+ dest: /etc/zfs/zed.d/history_event-zfs-list-cacher.sh
+ state: link
+
+- name: create base-directory for zfs-list.cache
+ file:
+ path: /etc/zfs/zfs-list.cache/
+ state: directory
+
+- name: create zfs-list.cache file for zpools
+ loop: "{{ zfs_zpools | dict2items }}"
+ loop_control:
+ label: "{{ item.key }}"
+ copy:
+ content: ""
+ dest: "/etc/zfs/zfs-list.cache/{{ item.key }}"
+ force: no
+
+## TODO: if this is installed after the zpool has already been created zed needs to be triggered
+## using someing like: zfs set canmount=on DATASET
diff --git a/roles/zfs/base/tasks/main.yml b/roles/zfs/base/tasks/main.yml
index e86b974b..ad5d1ce2 100644
--- a/roles/zfs/base/tasks/main.yml
+++ b/roles/zfs/base/tasks/main.yml
@@ -22,25 +22,9 @@
- zfs-zed
state: present
-- name: enable zfs-list-cacher zlet for systemd zfs-mount-generator
- file:
- src: /usr/lib/zfs-linux/zed.d/history_event-zfs-list-cacher.sh
- dest: /etc/zfs/zed.d/history_event-zfs-list-cacher.sh
- state: link
-
-- name: create base-directory for zfs-list.cache
- file:
- path: /etc/zfs/zfs-list.cache/
- state: directory
-
-- name: create zfs-list.cache file for zpools
- loop: "{{ zfs_zpools | dict2items }}"
- loop_control:
- label: "{{ item.key }}"
- copy:
- content: ""
- dest: "/etc/zfs/zfs-list.cache/{{ item.key }}"
- force: no
+- name: enable systemd -mount-generator
+ when: zfs_use_systemd_mount_generator
+ import_tasks: enable-systemd-mount-generator.yml
- name: create zpools
loop: "{{ zfs_zpools | dict2items }}"