summaryrefslogtreecommitdiff
path: root/roles/zfs/base/tasks/Debian.yml
blob: 2a3d608e21364037d07184fa65f08cc85cd9e802 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
- 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: install zfs-dkms and utilities (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: 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