feat(restic): migrate to systemd template units

This commit is contained in:
2025-03-09 13:07:03 +01:00
parent ed95d4fd3d
commit 0aba4024de
14 changed files with 231 additions and 147 deletions

View File

@ -0,0 +1,30 @@
---
- name: Ensure systemd timer file for '{{ restic_job_name }}' is {{ restic_state }}'
ansible.builtin.template:
dest: "/etc/systemd/system/{{ restic_systemd_unit_naming_scheme }}.timer"
src: restic.timer.j2
owner: root
group: root
mode: "0640"
when: restic_state == 'present'
register: restic_systemd_timer_info
notify:
- reload-systemd
- name: Ensure restic configuration for '{{ restic_job_name }}' is {{ restic_job_state }}
ansible.builtin.template:
src: "restic.conf.j2"
dest: "{{ restic_job_directory }}/{{ restic_job_name }}.conf"
mode: "0640"
when: restic_job_state in ['present', 'masked']
notify:
- trigger-restic
- name: Ensure restic configuration for '{{ restic_job_name }}' is {{ restic_job_state }}
ansible.builtin.file:
path: "{{ restic_job_directory }}/{{ restic_job_name }}.conf"
state: "{{ restic_job_state }}"
when: restic_job_state not in ['present', 'masked']
- name: Flush handlers to ensure systemd knows about '{{ restic_job_name }}'
meta: flush_handlers