aboutsummaryrefslogtreecommitdiff
path: root/tasks/main.yaml
blob: 0aaba58190fedec6ec33864bf596b451d9300aa9 (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
---
- name: Install packages
  block:
    - apt:
        name:
          - linux-headers-amd64
          - zfs-dkms
    - apt:
        name: zfsutils-linux
        default_release: "{{ ansible_distribution_release | lower }}-backports"
      when: ansible_facts.distribution_release == 'bullseye'
    - apt:
        name: zfsutils-linux
      when: ansible_facts.distribution_release != 'bullseye'

- name: Add the zfs module
  community.general.modprobe:
    name: zfs
    state: present

- include_tasks: zpool.yaml
  loop: "{{ zpools }}"
  loop_control:
    loop_var: zpool

- name: Create ZVOL
  community.general.zfs:
    name: "{{ zvol.pool }}/{{ zvol.name }}"
    state: "{{ zvol.state }}"
    extra_zfs_properties: "{{ zvol.extra_zfs_properties }}"
  loop: "{{ zvols }}"
  loop_control:
    loop_var: zvol