summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-05-22 01:28:54 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-05-25 00:04:27 +0200
commite3f04b3a488adb06b0fec892cf1b85fc15ed5ed7 (patch)
tree8e8c1a49925d73d9611111ccd1e713974fe450b0
parentfix last commit for python2 (diff)
zfs: enable systemd mount-generator
-rw-r--r--roles/zfs/base/tasks/Debian.yml38
-rw-r--r--roles/zfs/base/tasks/Ubuntu.yml5
-rw-r--r--roles/zfs/base/tasks/main.yml29
3 files changed, 42 insertions, 30 deletions
diff --git a/roles/zfs/base/tasks/Debian.yml b/roles/zfs/base/tasks/Debian.yml
index 2a3d608e..a1ed0387 100644
--- a/roles/zfs/base/tasks/Debian.yml
+++ b/roles/zfs/base/tasks/Debian.yml
@@ -10,37 +10,25 @@
- apt_repo_components is defined
- "'contrib' in apt_repo_components"
-- name: install zfs-dkms and utilities (buster)
+- 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: install zfs modules via dkms
- apt:
- name: zfs-dkms
- default_release: buster-backports
- state: present
-
- - name: install zfs file system utilities
- apt:
- name: zfsutils-linux
- default_release: buster-backports
- state: present
-
-- name: install zfs-dkms and utilities (bullseye and beyond)
- when: (ansible_distribution_major_version | int) > 10
- block:
- - name: install zfs modules via dkms
- apt:
- name: zfs-dkms
- state: present
-
- - name: install zfs file system utilities
- apt:
- name: zfsutils-linux
- state: present
+ - 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
- name: check if module is available for the currently running kernel
command: modprobe --dry-run zfs
diff --git a/roles/zfs/base/tasks/Ubuntu.yml b/roles/zfs/base/tasks/Ubuntu.yml
index d45c30e4..9745d716 100644
--- a/roles/zfs/base/tasks/Ubuntu.yml
+++ b/roles/zfs/base/tasks/Ubuntu.yml
@@ -1,5 +1,2 @@
---
-- name: install zfs file system utilities
- apt:
- name: zfsutils-linux
- state: present
+## nothing to do here - zfs modules are part of ubuntu core already
diff --git a/roles/zfs/base/tasks/main.yml b/roles/zfs/base/tasks/main.yml
index ec1b04bf..e86b974b 100644
--- a/roles/zfs/base/tasks/main.yml
+++ b/roles/zfs/base/tasks/main.yml
@@ -7,7 +7,7 @@
options zfs zfs_arc_max={{ zfs_arc_size.max }}
dest: /etc/modprobe.d/zfs.conf
-- name: install zfs modules and utilities
+- name: install zfs modules
include_tasks: "{{ ansible_distribution }}.yml"
- name: load zfs kernel module
@@ -15,6 +15,33 @@
name: zfs
state: present
+- name: install zed and zfs file system utilities
+ apt:
+ name:
+ - zfsutils-linux
+ - 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: create zpools
loop: "{{ zfs_zpools | dict2items }}"
loop_control: