summaryrefslogtreecommitdiff
path: root/roles/zfs/base/tasks
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-05-26 23:50:38 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-05-26 23:50:38 +0200
commitacc437083cfa7b8f77b8e79af2a0c05bd871e198 (patch)
tree576360023addac147bef43f1ba340c61e3c9fe5b /roles/zfs/base/tasks
parentremove nextcloud test instance (diff)
parentcleanup old configs and playbooks (diff)
Merge branch 'topic/zfs-buster-backports'
Diffstat (limited to 'roles/zfs/base/tasks')
-rw-r--r--roles/zfs/base/tasks/Debian.yml24
-rw-r--r--roles/zfs/base/tasks/Ubuntu.yml2
-rw-r--r--roles/zfs/base/tasks/enable-systemd-mount-generator.yml23
-rw-r--r--roles/zfs/base/tasks/main.yml10
4 files changed, 54 insertions, 5 deletions
diff --git a/roles/zfs/base/tasks/Debian.yml b/roles/zfs/base/tasks/Debian.yml
index b9fdda95..a1ed0387 100644
--- a/roles/zfs/base/tasks/Debian.yml
+++ b/roles/zfs/base/tasks/Debian.yml
@@ -3,9 +3,29 @@
import_role:
name: prepare-dkms
-## TODO: make sure contrib repo is enabled
+- name: check if contrib apt component is enabled
+ assert:
+ msg: "Debian zfs packages are in contrib - please enable it using 'apt_repo_components'"
+ that:
+ - apt_repo_components is defined
+ - "'contrib' in apt_repo_components"
-- name: install zfs-dkms
+- name: enable backports and force ZFS packages from backports for buster
+ when: (ansible_distribution_major_version | int) == 10
+ block:
+ - name: add backports repo
+ include_role:
+ name: apt-repo/backports
+
+ - name: pin zfs packages to buster-backports
+ copy:
+ content: |
+ Package: libnvpair1linux libuutil1linux libzfs2linux libzpool2linux spl-dkms zfs-dkms zfs-test zfsutils-linux zfsutils-linux-dev zfs-zed
+ Pin: release n=buster-backports
+ Pin-Priority: 990
+ dest: /etc/apt/preferences.d/zfs-from-buster-backports
+
+- name: install zfs modules via dkms
apt:
name: zfs-dkms
state: present
diff --git a/roles/zfs/base/tasks/Ubuntu.yml b/roles/zfs/base/tasks/Ubuntu.yml
index 0ce85358..9745d716 100644
--- a/roles/zfs/base/tasks/Ubuntu.yml
+++ b/roles/zfs/base/tasks/Ubuntu.yml
@@ -1,2 +1,2 @@
---
-# Nothing to do here.
+## nothing to do here - zfs modules are part of ubuntu core already
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 e6f2347b..ad5d1ce2 100644
--- a/roles/zfs/base/tasks/main.yml
+++ b/roles/zfs/base/tasks/main.yml
@@ -15,11 +15,17 @@
name: zfs
state: present
-- name: install zfs file system utilities
+- name: install zed and zfs file system utilities
apt:
- name: zfsutils-linux
+ name:
+ - zfsutils-linux
+ - zfs-zed
state: present
+- 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 }}"
loop_control: