ansible-edda/playbooks/tasks/hosts/zfs-trim.yml

33 lines
880 B
YAML

- name: Zfs trim service file
copy:
src: ./filesystem/{{ ansible_hostname }}/etc/systemd/system/zfs-trim@.service
dest: /etc/systemd/system/zfs-trim@.service
mode: 0644
register: systemd_zfs_trim_service_file
- name: Zfs trim timer file
copy:
src: ./filesystem/{{ ansible_hostname }}/etc/systemd/system/zfs-trim-monthly@.timer
dest: /etc/systemd/system/zfs-trim-monthly@.timer
mode: 0644
register: systemd_zfs_trim_monthly_timer_file
- name: SystemD daemon reload
systemd:
daemon_reload: true
when:
systemd_zfs_trim_service_file is changed or
systemd_zfs_trim_monthly_timer_file is changed
- name: Enable zfs trim of bpool
systemd:
name: zfs-trim-monthly@bpool.timer
enabled: yes
state: started
- name: Enable zfs trim of rpool
systemd:
name: zfs-trim-monthly@rpool.timer
enabled: yes
state: started