diff --git a/ansible/group_vars/all/sanoid.yml b/ansible/group_vars/all/sanoid.yml new file mode 100644 index 0000000..ffc4690 --- /dev/null +++ b/ansible/group_vars/all/sanoid.yml @@ -0,0 +1,13 @@ +sanoid_datasets: + tank: + use_template: production + recursive: true +sanoid_templates: + production: + frequently: 0 + hourly: 36 + daily: 30 + monthly: 3 + yearly: 0 + autosnap: true + autoprune: true diff --git a/ansible/roles/zfs/files/sanoid.conf b/ansible/roles/zfs/files/sanoid.conf index ee92b78..0474ec3 100644 --- a/ansible/roles/zfs/files/sanoid.conf +++ b/ansible/roles/zfs/files/sanoid.conf @@ -3,19 +3,20 @@ # It should go in /etc/sanoid. # ###################################### -[tank] - use_template = production - recursive = yes +{% for name, config in sanoid_datasets.items() %} +[{{ name }}] + {% for key, value in config.items() %} + {{ key }} = {{ value | lower }} + {% endfor %} +{% endfor %} ############################# # templates below this line # ############################# -[template_production] - frequently = 0 - hourly = 36 - daily = 30 - monthly = 3 - yearly = 0 - autosnap = yes - autoprune = yes +{% for name, config in sanoid_templates.items() %} +[template_{{ name }}] + {% for key, value in config.items() %} + {{ key }} = {{ value | lower }} + {% endfor %} +{% endfor %}