diff --git a/ansible/roles/zfs/tasks/sanoid.yml b/ansible/roles/zfs/tasks/sanoid.yml index 31cae6f..5ed8e9d 100644 --- a/ansible/roles/zfs/tasks/sanoid.yml +++ b/ansible/roles/zfs/tasks/sanoid.yml @@ -62,9 +62,17 @@ mode: "0755" become: true -- name: Install cron job - cron: - name: sanoid - special_time: hourly - job: TZ=UTC /usr/local/sbin/sanoid --cron --verbose +- name: Install systemd services + file: + src: /opt/sanoid/packages/debian/{{ item }} + dest: /lib/systemd/system/{{ item }} + state: link + loop: "{{ sanoid_services }}" + become: true + +- name: Enable systemd services + service: + name: "{{ item }}" + enabled: true + loop: "{{ sanoid_services }}" become: true diff --git a/ansible/roles/zfs/vars/main.yml b/ansible/roles/zfs/vars/main.yml new file mode 100644 index 0000000..a74fba0 --- /dev/null +++ b/ansible/roles/zfs/vars/main.yml @@ -0,0 +1,4 @@ +sanoid_services: + - sanoid.timer + - sanoid.service + - sanoid-prune.service