ansible-edda/playbooks/tasks/backups/00-zfs-snapshots.d/sanoid.yml

50 lines
1.5 KiB
YAML
Raw Normal View History

- name: Configure sanoid system snapshots
blockinfile:
path: /etc/sanoid/sanoid.conf
create: yes
mode: 0644
insertbefore: "BOF"
marker: "# {mark} ANSIBLE MANAGED BLOCK SYSTEM #"
block: |
[bpool/BOOT]
2022-11-10 00:13:15 +01:00
use_template = system
recursive = yes
process_children_only = yes
[rpool/ROOT]
2022-11-10 00:13:15 +01:00
use_template = system
recursive = yes
process_children_only = yes
[rpool/home]
2022-11-10 00:13:15 +01:00
use_template = system,home
recursive = yes
process_children_only = yes
- name: Configure sanoid service snapshots
blockinfile:
path: /etc/sanoid/sanoid.conf
insertbefore: "# BEGIN ANSIBLE MANAGED BLOCK TEMPLATES #"
marker: "# {mark} ANSIBLE MANAGED BLOCK SERVICE {{ service_name }} #"
block: |
[rpool/var/lib/{{ ansible_hostname }}/data/pod-{{ service_name }}]
use_template = production
recursive = yes
process_children_only = yes
[hpool/backup/{{ ansible_hostname }}/data/pod-{{ service_name }}]
use_template = backup
recursive = yes
process_children_only = yes
with_items: "{{ host_services }}"
loop_control:
loop_var: service_name
- name: Configure sanoid templates
blockinfile:
path: /etc/sanoid/sanoid.conf
insertafter: "EOF"
marker: "# {mark} ANSIBLE MANAGED BLOCK TEMPLATES #"
block: "{{ lookup('file', './filesystem/{{ ansible_hostname }}/etc/sanoid/sanoid-templates.conf') }}"