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

39 lines
1.1 KiB
YAML

- name: Zpool status mail script
template:
src: ./filesystem/{{ ansible_hostname }}/usr/local/sbin/systemd-mail-zpool-status.j2
dest: /usr/local/sbin/systemd-mail-zpool-status
mode: 0755
- name: Zfs scrub service file
copy:
src: ./filesystem/{{ ansible_hostname }}/etc/systemd/system/zfs-scrub@.service
dest: /etc/systemd/system/zfs-scrub@.service
mode: 0644
register: systemd_zfs_scrub_service_file
- name: Zfs scrub timer file
copy:
src: ./filesystem/{{ ansible_hostname }}/etc/systemd/system/zfs-scrub-monthly@.timer
dest: /etc/systemd/system/zfs-scrub-monthly@.timer
mode: 0644
register: systemd_zfs_scrub_monthly_timer_file
- name: SystemD daemon reload
systemd:
daemon_reload: true
when:
systemd_zfs_scrub_service_file is changed or
systemd_zfs_scrub_monthly_timer_file is changed
- name: Enable zfs scrub of bpool
systemd:
name: zfs-scrub-monthly@bpool.timer
enabled: yes
state: started
- name: Enable zfs scrub of rpool
systemd:
name: zfs-scrub-monthly@rpool.timer
enabled: yes
state: started