"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 - .tmux.conf
- .gitconfig - .gitconfig
### mgrote.sanoid ### mgrote.sanoid
sanoid_zfs_recursive: 'yes' sanoid_datasets:
sanoid_zfs_dataset: "hdd_data_raidz/data" - { path: 'hdd_data_raidz/data', template: 'fiveminutes', recursive: ' no' }
sanoid_snapshot_interval_underhour: '5' - { path: 'hdd_data_raidz/videos', template: 'hourly', recursive: ' yes' }
sanoid_snapshot_keep_underhour: '36'
sanoid_snapshot_keep_daily: '31'
sanoid_snapshot_keep_monthly: '6'
sanoid_snapshot_keep_hourly: '24'
### mgrote.smart ### mgrote.smart
smart_smartctlmail_cron_minutes: "15" smart_smartctlmail_cron_minutes: "15"
smart_smartctlmail_cron_hours: "6" smart_smartctlmail_cron_hours: "6"

View file

@ -8,7 +8,7 @@
############################################################################### ###############################################################################
# in PVE # in PVE
# pct set 109 -mp1 /hdd_data_raidz/data,mp=/shares/ # 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: '*' sanoid_cron_hours: '*'
# Wann soll das sanoid-script mit cron ausgeführt werden? (Minuten)
# Default Value for Sanoid Cron Minutes
sanoid_cron_minutes: '*' sanoid_cron_minutes: '*'
# Default Value for Sanoid Keep Hourly Snapshot ### Definition der Variablen für die sanoid-templates-
sanoid_snapshot_keep_hourly: '1' # 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 ### "Default" Datasets
sanoid_snapshot_keep_daily: '14' sanoid_datasets:
- { path: 'hdd_data_raidz/data', template: 'fiveminutes', recursive: ' no' }
# Default Value for Sanoid Keep Monthly Snapshot - { path: 'hdd_data_raidz/videos', template: 'hourly', recursive: ' yes' }
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'

View file

@ -1,18 +1,40 @@
## ZFS Section ## ## ZFS Section ##
[{{ sanoid_zfs_dataset }}] {% for item in sanoid_datasets %}
use_template = production [{{ item.path }}]
recursive = {{ sanoid_zfs_recursive }} use_template = {{ item.template }}
recursive = {{ item.recursive }}
## ----------- ##
{% endfor %}
## Template Section ## ## Template Section ##
[template_production] [template_fiveminutes]
## Keep-Rules ## Keep-Rules
hourly = {{ sanoid_snapshot_keep_hourly }} hourly = {{ sanoid_template_fiveminutes_snapshot_keep_hourly }}
daily = {{ sanoid_snapshot_keep_daily }} daily = {{ sanoid_template_fiveminutes_snapshot_keep_daily }}
monthly = {{ sanoid_snapshot_keep_monthly }} monthly = {{ sanoid_template_fiveminutes_snapshot_keep_monthly }}
yearly = {{ sanoid_snapshot_keep_yearly }} yearly = {{ sanoid_template_fiveminutes_snapshot_keep_yearly }}
## Underhour - Snapshots frequently = {{ sanoid_template_fiveminutes_snapshot_keep_underhour }}
frequent_period = {{ sanoid_snapshot_interval_underhour }} ## Underhour intervall
frequently = {{ sanoid_snapshot_keep_underhour }} frequent_period = {{ sanoid_template_fiveminutes_snapshot_interval_underhour }}
## Other Options ## Other Options
autosnap = {{ sanoid_auto_snap }} autosnap = {{ sanoid_template_fiveminutes_auto_snap }}
autoprune = {{ sanoid_auto_prune }} 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 }}