Initial Commit

This commit is contained in:
chale 2025-05-20 16:31:56 -06:00
commit ac2d974e4b
10 changed files with 234 additions and 0 deletions

View file

@ -0,0 +1,13 @@
[Unit]
Description=Cleanup ZFS Pool
Requires=zfs.target
After=zfs.target sanoid.service
ConditionFileNotEmpty=/etc/sanoid/sanoid.conf
[Service]
Environment=TZ=UTC
Type=oneshot
ExecStart=/usr/local/sbin/sanoid --prune-snapshots --verbose
[Install]
WantedBy=sanoid.service

View file

@ -0,0 +1,55 @@
{% for pool in sanoid_config.pools %}
[{{ pool.name }}]
{% if pool.template != '' %}
use_template={{pool.template}}
{% endif %}
{% if pool.recursive|default('') != '' %}
recursive={{pool.recursive}}
{% endif %}
{% if pool.hourly|default('') != '' %}
hourly = {{ pool.hourly }}
{% endif %}
{% if pool.daily|default('') != '' %}
daily = {{ pool.daily }}
{% endif %}
{% if pool.monthly|default('') != '' %}
monthly = {{ pool.montly }}
{% endif %}
{% if pool.yearly|default('') != '' %}
yearly = {{ pool.yearly }}
{% endif %}
{% if pool.autosnap|default('') != '' %}
autosnap = {{ pool.autosnap }}
{% endif %}
{% if pool.autoprune|default('') != '' %}
autoprune = {{ pool.autoprune }}
{% endif %}
{% endfor %}
########### TEMPLATES ###########
{% for template in sanoid_config.templates %}
[template_{{ template.name }}]
{% if template.hourly|default('') != '' %}
hourly = {{ template.hourly }}
{% endif %}
{% if template.daily|default('') != '' %}
daily = {{ template.daily }}
{% endif %}
{% if template.monthly|default('') != '' %}
monthly = {{ template.montly }}
{% endif %}
{% if template.yearly|default('') != '' %}
yearly = {{ template.yearly }}
{% endif %}
{% if template.autosnap|default('') != '' %}
autosnap = {{ template.autosnap }}
{% endif %}
{% if template.autoprune|default('') != '' %}
autoprune = {{ template.autoprune }}
{% endif %}
{% if template.recursive|default('') != '' %}
recursive = {{ template.recursive }}
{% endif %}
{% endfor %}

View file

@ -0,0 +1,12 @@
[Unit]
Description=Snapshot ZFS Pool
Requires=zfs.target
After=zfs.target
Wants=sanoid-prune.service
Before=sanoid-prune.service
ConditionFileNotEmpty=/etc/sanoid/sanoid.conf
[Service]
Environment=TZ=UTC
Type=oneshot
ExecStart=/usr/local/sbin/sanoid --take-snapshots --verbose

View file

@ -0,0 +1,10 @@
[Unit]
Description=Run Sanoid Every 15 Minutes
Requires=sanoid.service
[Timer]
OnCalendar=*:0/15
Persistent=true
[Install]
WantedBy=timers.target