33 lines
1.0 KiB
YAML
33 lines
1.0 KiB
YAML
|
- name: Install the restic backup script
|
||
|
copy:
|
||
|
src: ./filesystem/{{ ansible_hostname }}/usr/local/sbin/restic-service-data
|
||
|
dest: /usr/local/sbin/restic-service-data
|
||
|
mode: 0755
|
||
|
|
||
|
- name: Install the restic backup service file
|
||
|
template:
|
||
|
src: ./filesystem/{{ ansible_hostname }}/etc/systemd/system/restic-service-data.service.j2
|
||
|
dest: /etc/systemd/system/restic-service-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-service-data.timer
|
||
|
dest: /etc/systemd/system/restic-service-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-service-data.timer
|
||
|
enabled: yes
|
||
|
state: started
|