"Refactor" Sanoid Role (#18)

Datasets können einzeln mit verschiedenen Templates konfiguriert werden

Co-authored-by: Michael Grote <38253905+quotengrote@users.noreply.github.com>
Reviewed-on: mg/ansible#18
Co-Authored-By: mg <michael.grote@posteo.de>
Co-Committed-By: mg <michael.grote@posteo.de>
This commit is contained in:
Michael Grote 2020-12-30 23:49:26 +01:00
parent ec7d58377e
commit e1cc8f6d35
4 changed files with 68 additions and 46 deletions

View file

@ -11,13 +11,9 @@
- .tmux.conf
- .gitconfig
### mgrote.sanoid
sanoid_zfs_recursive: 'yes'
sanoid_zfs_dataset: "hdd_data_raidz/data"
sanoid_snapshot_interval_underhour: '5'
sanoid_snapshot_keep_underhour: '36'
sanoid_snapshot_keep_daily: '31'
sanoid_snapshot_keep_monthly: '6'
sanoid_snapshot_keep_hourly: '24'
sanoid_datasets:
- { path: 'hdd_data_raidz/data', template: 'fiveminutes', recursive: ' no' }
- { path: 'hdd_data_raidz/videos', template: 'hourly', recursive: ' yes' }
### mgrote.smart
smart_smartctlmail_cron_minutes: "15"
smart_smartctlmail_cron_hours: "6"

View file

@ -8,7 +8,7 @@
###############################################################################
# in PVE
# pct set 109 -mp1 /hdd_data_raidz/data,mp=/shares/
# pct set 109 -mp0 /hdd_data_raidz/data_videos,mp=/shares_videos
# pct set 109 -mp0 /hdd_data_raidz/videos,mp=/shares_videos
###############################################################################
---

View file

@ -1,30 +1,34 @@
---
# Default Value for Sanoid Cron Hours
# Wann soll das sanoid-script mit cron ausgeführt werden? (Stunden)
sanoid_cron_hours: '*'
# Default Value for Sanoid Cron Minutes
# Wann soll das sanoid-script mit cron ausgeführt werden? (Minuten)
sanoid_cron_minutes: '*'
# Default Value for Sanoid Keep Hourly Snapshot
sanoid_snapshot_keep_hourly: '1'
### Definition der Variablen für die sanoid-templates-
# template_fiveminutes
sanoid_template_fiveminutes_snapshot_keep_hourly: '24' # Aufheben (Stunde)
sanoid_template_fiveminutes_snapshot_keep_daily: '31' # Aufheben (Tage)
sanoid_template_fiveminutes_snapshot_keep_monthly: '6' # Aufheben (Monate)
sanoid_template_fiveminutes_snapshot_keep_yearly: '0' # Aufheben (Jahre)
sanoid_template_fiveminutes_snapshot_interval_underhour: '5' # Intervall (alle 5 Minuten)
sanoid_template_fiveminutes_snapshot_keep_underhour: '36' # Aufheben (Minuten)
sanoid_template_fiveminutes_auto_snap: 'yes' # Automatisches erstellen von Snapshots
sanoid_template_fiveminutes_prune: 'yes' # Automatisches Löschen/Prunen alter Snapshots
# template_hourly
sanoid_template_hourly_snapshot_keep_hourly: '24'
sanoid_template_hourly_snapshot_keep_daily: '31'
sanoid_template_hourly_snapshot_keep_monthly: '6'
sanoid_template_hourly_snapshot_keep_yearly: '1'
sanoid_template_hourly_auto_snap: 'yes'
sanoid_template_hourly_prune: 'yes'
# template_daily
sanoid_template_daily_snapshot_keep_daily: '31'
sanoid_template_daily_snapshot_keep_monthly: '6'
sanoid_template_daily_snapshot_keep_yearly: '1'
sanoid_template_daily_auto_snap: 'yes'
sanoid_template_daily_prune: 'yes'
# Default Value for Sanoid Keep Daily Snapshot
sanoid_snapshot_keep_daily: '14'
# Default Value for Sanoid Keep Monthly Snapshot
sanoid_snapshot_keep_monthly: '3'
# Default Value for Sanoid Keep Yearly Snapshot
sanoid_snapshot_keep_yearly: '0'
# Default Value for Sanoid Auto Snapshot
sanoid_auto_snap: 'yes'
# Default Value for Sanoid Auto Prune
sanoid_auto_prune: 'yes'
# Default Value for Sanoid ZFS Dataset Name
sanoid_zfs_dataset: 'hdd_data_raidz/data'
# Default Value for Sanoid ZFS Recursive Snapshot
sanoid_zfs_recursive: 'yes'
### "Default" Datasets
sanoid_datasets:
- { path: 'hdd_data_raidz/data', template: 'fiveminutes', recursive: ' no' }
- { path: 'hdd_data_raidz/videos', template: 'hourly', recursive: ' yes' }

View file

@ -1,18 +1,40 @@
## ZFS Section ##
[{{ sanoid_zfs_dataset }}]
use_template = production
recursive = {{ sanoid_zfs_recursive }}
{% for item in sanoid_datasets %}
[{{ item.path }}]
use_template = {{ item.template }}
recursive = {{ item.recursive }}
## ----------- ##
{% endfor %}
## Template Section ##
[template_production]
[template_fiveminutes]
## Keep-Rules
hourly = {{ sanoid_snapshot_keep_hourly }}
daily = {{ sanoid_snapshot_keep_daily }}
monthly = {{ sanoid_snapshot_keep_monthly }}
yearly = {{ sanoid_snapshot_keep_yearly }}
## Underhour - Snapshots
frequent_period = {{ sanoid_snapshot_interval_underhour }}
frequently = {{ sanoid_snapshot_keep_underhour }}
hourly = {{ sanoid_template_fiveminutes_snapshot_keep_hourly }}
daily = {{ sanoid_template_fiveminutes_snapshot_keep_daily }}
monthly = {{ sanoid_template_fiveminutes_snapshot_keep_monthly }}
yearly = {{ sanoid_template_fiveminutes_snapshot_keep_yearly }}
frequently = {{ sanoid_template_fiveminutes_snapshot_keep_underhour }}
## Underhour intervall
frequent_period = {{ sanoid_template_fiveminutes_snapshot_interval_underhour }}
## Other Options
autosnap = {{ sanoid_auto_snap }}
autoprune = {{ sanoid_auto_prune }}
autosnap = {{ sanoid_template_fiveminutes_auto_snap }}
autoprune = {{ sanoid_template_fiveminutes_prune }}
[template_hourly]
## Keep-Rules
hourly = {{ sanoid_template_hourly_snapshot_keep_hourly }}
daily = {{ sanoid_template_hourly_snapshot_keep_daily }}
monthly = {{ sanoid_template_hourly_snapshot_keep_monthly }}
yearly = {{ sanoid_template_hourly_snapshot_keep_yearly }}
## Other Options
autosnap = {{ sanoid_template_hourly_auto_snap }}
autoprune = {{ sanoid_template_hourly_prune }}
[template_daily]
## Keep-Rules
daily = {{ sanoid_template_daily_snapshot_keep_daily }}
monthly = {{ sanoid_template_daily_snapshot_keep_monthly }}
yearly = {{ sanoid_template_daily_snapshot_keep_yearly }}
## Other Options
autosnap = {{ sanoid_template_daily_auto_snap }}
autoprune = {{ sanoid_template_daily_prune }}