Files
ansible/roles/backup/templates/restic-backup.sh.j2
T
2026-09-03 20:40:11 +02:00

27 lines
694 B
Django/Jinja

#!/bin/bash
## Ansible managed
set -e
## Environment is injected by the systemd unit via EnvironmentFile=/etc/restic-backup.env. Run manually with: systemctl start restic-backup.service
echo "Starting Restic Backup at $(date)"
## Run the backup using paths and exclusions defined as group_vars
restic backup \
{% for path in backup_include_paths %}
"{{ path }}" \
{% endfor %}
{% for path in backup_exclude_paths %}
--exclude "{{ path }}" \
{% endfor %}
--cleanup-cache
restic forget \
--prune \
--keep-daily {{ backup_retention_daily }} \
--keep-weekly {{ backup_retention_weekly }} \
--keep-monthly {{ backup_retention_monthly }}
echo "Restic backup completed at $(date)"