| 1 | --- |
| 2 | - name: Install ZFS on Debian |
| 3 | when: ansible_distribution == 'Debian' |
| 4 | apt: |
| 5 | name: zfs-dkms |
| 6 | - name: Set ZFS module options |
| 7 | community.general.modprobe: |
| 8 | name: zfs |
| 9 | state: present |
| 10 | params: "zfs_arc_max={{zfs_arc_max}}" |
| 11 | - name: Set default compression |
| 12 | community.general.zfs: |
| 13 | name: "tank" |
| 14 | state: present |
| 15 | extra_zfs_properties: |
| 16 | compression: zstd |
| 17 | atime: 'off' |
| 18 | xattr: 'sa' |
| 19 | - name: Create datasets |
| 20 | community.general.zfs: |
| 21 | name: "tank/{{item}}" |
| 22 | state: present |
| 23 | extra_zfs_properties: |
| 24 | mountpoint: 'none' |
| 25 | with_items: |
| 26 | - libvirt |
| 27 | - lxd |
| 28 | - name: Create ISO dataset |
| 29 | community.general.zfs: |
| 30 | name: 'tank/iso' |
| 31 | state: present |
| 32 | extra_zfs_properties: |
| 33 | mountpoint: '/var/lib/iso' |
| 34 | - name: Create libvirt/images dataset |
| 35 | community.general.zfs: |
| 36 | name: 'tank/libvirt/images' |
| 37 | state: present |
| 38 | extra_zfs_properties: |
| 39 | mountpoint: '/var/lib/libvirt/images' |
| 40 | recordsize: '64k' |