ansible-edda/playbooks/tasks/backups/02-restic-enable.yml

33 lines
1.0 KiB
YAML

- name: Install the restic backup script
copy:
src: ./filesystem/{{ ansible_hostname }}/usr/local/sbin/restic-volume-data
dest: /usr/local/sbin/restic-volume-data
mode: 0755
- name: Install the restic backup service file
template:
src: ./filesystem/{{ ansible_hostname }}/etc/systemd/system/restic-volume-data.service.j2
dest: /etc/systemd/system/restic-volume-data.service
mode: 0644
register: systemd_restic_service_data_service_file
- name: Install the restic backup timer file
copy:
src: ./filesystem/{{ ansible_hostname }}/etc/systemd/system/restic-volume-data.timer
dest: /etc/systemd/system/restic-volume-data.timer
mode: 0644
register: systemd_restic_service_data_timer_file
- name: SystemD daemon reload
systemd:
daemon_reload: true
when:
systemd_restic_service_data_service_file is changed or
systemd_restic_service_data_timer_file is changed
- name: Enable restic backup
systemd:
name: restic-volume-data.timer
enabled: yes
state: started