added compression on zfs role

This commit is contained in:
g33kex 2022-07-23 09:51:25 +02:00
parent 14a6a2ab3f
commit ebc90e7f9d
3 changed files with 8 additions and 3 deletions

View file

@ -29,6 +29,7 @@ ipv6_forwarding: false
zfs_pools: zfs_pools:
- name: tank0 - name: tank0
compression: 'lz4'
vdevs: vdevs:
- type: raidz1 - type: raidz1
disks: disks:
@ -40,7 +41,6 @@ zfs_pools:
properties: properties:
autoreplace: 'on' autoreplace: 'on'
datasets: datasets:
- name: iso_images - name: static
- name: containers - name: dynamic
- name: vms

View file

@ -28,6 +28,7 @@ zfs_pools:
quota: '1T' quota: '1T'
mountpoint: '/mnt' mountpoint: '/mnt'
- name: non_redondant_pool - name: non_redondant_pool
compression: 'lz4'
disks: disks:
- ada9 - ada9
- ada10 - ada10

View file

@ -39,6 +39,10 @@
{% endif %} {% endif %}
when: pool_exists.rc == 1 when: pool_exists.rc == 1
- name: Set pool compression
command: zfs set compression={{ pool.compression }} {{ pool.name }}
when: pool.compression is defined and pool_exists.rc == 1
- name: Create datasets in the pool - name: Create datasets in the pool
community.general.zfs: community.general.zfs:
name: "{{ pool.name }}/{{ item.name }}" name: "{{ pool.name }}/{{ item.name }}"