--- - name: install dkms import_role: name: prepare-dkms - 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: enable backports and force ZFS packages from backports when: zfs_from_backports block: - name: add backports repo include_role: name: apt-repo/backports - name: pin zfs packages to backports copy: content: | Package: libnvpair*linux libuutil*linux libzfs*linux libzpool*linux spl-dkms zfs-dkms zfs-test zfsutils-linux zfsutils-linux-dev zfs-zed Pin: release n={{ ansible_distribution_release }}-backports Pin-Priority: 990 dest: /etc/apt/preferences.d/zfs-from-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 check_mode: no register: zfs_module_available failed_when: false changed_when: false - name: rebuild zfs module when: zfs_module_available.rc != 0 command: dpkg-reconfigure zfs-dkms