diff options
author | Christian Pointner <equinox@spreadspace.org> | 2020-05-23 04:02:28 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2020-05-25 00:04:27 +0200 |
commit | d5a8dc1066615935b6de278b31d7007e7a6c4597 (patch) | |
tree | 7ceb117e2dcf58c5dad6090eccac341d91a9d2ca /roles/zfs | |
parent | make use of zfs-mount-generator configureable (diff) |
add role zfs sanoid
Diffstat (limited to 'roles/zfs')
-rw-r--r-- | roles/zfs/sanoid/defaults/main.yml | 26 | ||||
-rw-r--r-- | roles/zfs/sanoid/tasks/main.yml | 15 | ||||
-rw-r--r-- | roles/zfs/sanoid/templates/sanoid.conf.j2 | 22 |
3 files changed, 63 insertions, 0 deletions
diff --git a/roles/zfs/sanoid/defaults/main.yml b/roles/zfs/sanoid/defaults/main.yml new file mode 100644 index 00000000..55ebbd9d --- /dev/null +++ b/roles/zfs/sanoid/defaults/main.yml @@ -0,0 +1,26 @@ +--- +zfs_sanoid_modules: {} + +zfs_sanoid_templates: + production: + frequently: 0 + hourly: 36 + daily: 7 + monthly: 0 + yearly: 0 + autosnap: yes + autoprune: yes + + backup: + frequently: 0 + hourly: 0 + daily: 60 + monthly: 6 + yearly: 0 + autosnap: no + autoprune: yes + + ignore: + autoprune: no + autosnap: no + monitor: no diff --git a/roles/zfs/sanoid/tasks/main.yml b/roles/zfs/sanoid/tasks/main.yml new file mode 100644 index 00000000..e35190e9 --- /dev/null +++ b/roles/zfs/sanoid/tasks/main.yml @@ -0,0 +1,15 @@ +--- +- name: install sanoid + apt: + name: sanoid + state: present + +- name: create sanoid config directory + file: + path: /etc/sanoid + state: directory + +- name: genarate sanoid config + template: + src: sanoid.conf.j2 + dest: /etc/sanoid/sanoid.conf diff --git a/roles/zfs/sanoid/templates/sanoid.conf.j2 b/roles/zfs/sanoid/templates/sanoid.conf.j2 new file mode 100644 index 00000000..2f2b29b4 --- /dev/null +++ b/roles/zfs/sanoid/templates/sanoid.conf.j2 @@ -0,0 +1,22 @@ +############################### +## modules +############################### +{% for name,options in zfs_sanoid_modules.items() %} + +[{{ name }}] +{% for option,value in options.items() %} + {{ option }} = {{ value }} +{% endfor %} +{% endfor %} + + +############################### +## templates +############################### +{% for name,options in zfs_sanoid_templates.items() %} + +[template_{{ name }}] +{% for option,value in options.items() %} + {{ option }} = {{ value }} +{% endfor %} +{% endfor %} |