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

39 lines
927 B
YAML

- name: Install sanoid
apt:
name: sanoid
- name: Create sanoid directory
file:
path: /etc/sanoid
state: directory
mode: 0755
- name: Configure sanoid
template:
src: ./filesystem/{{ ansible_hostname }}/etc/sanoid/sanoid.conf.j2
dest: /etc/sanoid/sanoid.conf
- name: Copy service for {{ ansible_hostname }} data replication
template:
src: ./filesystem/{{ ansible_hostname }}/etc/systemd/system/syncoid-volume-data.service.j2
dest: /etc/systemd/system/syncoid-volume-data.service
mode: 0644
register: systemd_syncoid_volume_data_service_file
- name: SystemD daemon reload
systemd:
daemon_reload: true
when:
systemd_syncoid_volume_data_service_file is changed
- name: Enable the replication service
systemd:
name: syncoid-volume-data.service
enabled: yes
- name: Enable the sanoid timer
systemd:
name: sanoid.timer
enabled: yes
state: started