Initial Commit
This commit is contained in:
commit
ac2d974e4b
10 changed files with 234 additions and 0 deletions
13
roles/sanoid/templates/sanoid-prune.service.j2
Normal file
13
roles/sanoid/templates/sanoid-prune.service.j2
Normal 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
|
55
roles/sanoid/templates/sanoid.conf.j2
Normal file
55
roles/sanoid/templates/sanoid.conf.j2
Normal 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 %}
|
12
roles/sanoid/templates/sanoid.service.j2
Normal file
12
roles/sanoid/templates/sanoid.service.j2
Normal 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
|
10
roles/sanoid/templates/sanoid.timer.j2
Normal file
10
roles/sanoid/templates/sanoid.timer.j2
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue