26 lines
723 B
YAML
26 lines
723 B
YAML
---
|
|
# NOTE: dmcrypt discourages using `discard` mount option (as in BTRFS on LUKS),
|
|
# so running trim manually in a cron job
|
|
- name: cron | Create fstrim weekly job
|
|
copy:
|
|
src: cron/fstrim
|
|
dest: /etc/periodic/weekly/fstrim
|
|
owner: root
|
|
group: root
|
|
mode: '755'
|
|
|
|
- name: cron | Create ZFS pool trim weekly job
|
|
copy:
|
|
content: |
|
|
#!/bin/sh
|
|
if /usr/sbin/zpool status {{ item }} | grep -qF "trimming"; then
|
|
exec /usr/sbin/zpool wait -t trim {{ item }}
|
|
else
|
|
exec /usr/sbin/zpool trim -w {{ item }}
|
|
fi
|
|
dest: /etc/periodic/weekly/trim-zfs-{{ item }}
|
|
mode: '755'
|
|
owner: root
|
|
group: root
|
|
loop: '{{ ansible_zfs_pools | map(attribute="name") | list }}'
|