Add sanoid Ansible role for ZFS snapshots and replication

Replaces manually deployed config files with a fully idempotent role:
installs sanoid, templates sanoid.conf and syncoid service/timer from
variables, enables both systemd timers. Removes static proxmox/sanoid.*
files. README rebuild section updated accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Adyrem
2026-05-16 04:22:05 +02:00
parent 18e05c2f88
commit 1cf6c81ac5
10 changed files with 128 additions and 51 deletions
@@ -0,0 +1,19 @@
{% for entry in sanoid_datasets %}
[{{ entry.dataset }}]
use_template = {{ entry.template }}
{% if entry.recursive %}
recursive = yes
{% endif %}
{% endfor %}
{% for name, t in sanoid_templates.items() %}
[template_{{ name }}]
daily = {{ t.daily }}
weekly = {{ t.weekly }}
monthly = {{ t.monthly }}
hourly = {{ t.hourly }}
frequently = {{ t.frequently }}
autosnap = {{ 'yes' if t.autosnap else 'no' }}
autoprune = {{ 'yes' if t.autoprune else 'no' }}
{% endfor %}
@@ -0,0 +1,9 @@
[Unit]
Description=Syncoid ZFS replication to HDD
After=zfs.target
[Service]
Type=oneshot
{% for job in syncoid_jobs %}
ExecStart=/usr/sbin/syncoid --no-privilege-elevation{% if job.recursive %} --recursive{% endif %} {{ job.src }} {{ job.dst }}
{% endfor %}
@@ -0,0 +1,11 @@
[Unit]
Description=Daily ZFS replication to HDD
After=sanoid.timer
[Timer]
OnCalendar={{ syncoid_schedule }}
RandomizedDelaySec={{ syncoid_randomized_delay }}
Persistent=true
[Install]
WantedBy=timers.target