diff options
Diffstat (limited to 'roles/zfs/base')
-rw-r--r-- | roles/zfs/base/defaults/main.yml | 9 | ||||
-rw-r--r-- | roles/zfs/base/tasks/Debian.yml | 24 | ||||
-rw-r--r-- | roles/zfs/base/tasks/Ubuntu.yml | 2 | ||||
-rw-r--r-- | roles/zfs/base/tasks/enable-systemd-mount-generator.yml | 23 | ||||
-rw-r--r-- | roles/zfs/base/tasks/main.yml | 10 |
5 files changed, 59 insertions, 9 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/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: |