Files
ansible-playbooks/roles/backup/tasks/job.yml
T
Clément Désiles ceca06ff2e feat(backup): add restic backup role with encrypted incremental snapshots
Restic-backed backups using a many-to-many repository/job model.

- repository = destination: restic repository URL verbatim (s3, local,
  removable device), backend credentials via env passthrough, retention
  policy, and an optional per-repository ntfy notify channel
- job = source set: paths, sqlite and postgres dumps (consistent .backup /
  pg_dump instead of torn live-file copies), pushed to one or more repos
- systemd timer per job, per-repo + per-job flock serialisation, restic
  check with read_data_subset for rotating integrity verification

Service roles declare what to back up (ntfy_backup_*, uptime_kuma_backup_*);
the inventory declares where.
2026-09-01 22:20:27 +02:00

37 lines
1.0 KiB
YAML

---
# Included per job with `job` set to the job dict.
- name: Deploy job definition for {{ job.name }}
ansible.builtin.template:
src: job.conf.j2
dest: "{{ backup_config_dir }}/jobs/{{ job.name }}.conf"
owner: root
group: root
mode: "0600"
- name: Create timer override directory for {{ job.name }}
ansible.builtin.file:
path: "/etc/systemd/system/backup@{{ job.name }}.timer.d"
state: directory
owner: root
group: root
mode: "0755"
when: job.schedule is defined
- name: Deploy schedule override for {{ job.name }}
ansible.builtin.template:
src: timer-schedule-override.conf.j2
dest: "/etc/systemd/system/backup@{{ job.name }}.timer.d/schedule.conf"
owner: root
group: root
mode: "0644"
when: job.schedule is defined
notify: Reload systemd
- name: Remove stale schedule override for {{ job.name }}
ansible.builtin.file:
path: "/etc/systemd/system/backup@{{ job.name }}.timer.d"
state: absent
when: job.schedule is not defined
notify: Reload systemd