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

39 lines
927 B
YAML
Raw Normal View History

2022-10-14 21:32:51 +02:00
- 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
2022-10-14 21:32:51 +02:00
mode: 0644
register: systemd_syncoid_volume_data_service_file
2022-10-14 21:32:51 +02:00
- name: SystemD daemon reload
systemd:
daemon_reload: true
when:
systemd_syncoid_volume_data_service_file is changed
2022-10-14 21:32:51 +02:00
- name: Enable the replication service
systemd:
name: syncoid-volume-data.service
2022-10-14 21:32:51 +02:00
enabled: yes
- name: Enable the sanoid timer
systemd:
name: sanoid.timer
enabled: yes
state: started