aboutsummaryrefslogtreecommitdiffstats
path: root/templates/borg_prune.service.j2
diff options
context:
space:
mode:
authorColin Wilk <colin@wilk.cx>2026-09-01 21:01:05 +0200
committerColin Wilk <colin@wilk.cx>2026-09-01 21:43:57 +0200
commit9c7586c7c3a235672ec6490d1a8bc44a222ce5d1 (patch)
tree8b36c5ee3105da2ae769c0d9cd96683d213c949d /templates/borg_prune.service.j2
parentfa137a92e1084a07608a4008ec0cb891baa76774 (diff)
downloadansible-role-borgbackup-9c7586c7c3a235672ec6490d1a8bc44a222ce5d1.tar.gz
ansible-role-borgbackup-9c7586c7c3a235672ec6490d1a8bc44a222ce5d1.zip
Add borg prune and compact jobs
Run repository retention either after a successful backup or from a dedicated systemd timer. Clean up script generation with templates and expand molecule test coverage. BREAKING CHANGE: Aggregate backup scripts are no longer managed, and state=preset now requires at least one readable included directory.
Diffstat (limited to 'templates/borg_prune.service.j2')
-rw-r--r--templates/borg_prune.service.j217
1 files changed, 17 insertions, 0 deletions
diff --git a/templates/borg_prune.service.j2 b/templates/borg_prune.service.j2
new file mode 100644
index 0000000..ce8e528
--- /dev/null
+++ b/templates/borg_prune.service.j2
@@ -0,0 +1,17 @@
+[Unit]
+Description=Runs borgbackup prune/compact retention job (ANSIBLE MANAGED)
+{% if borg_prune_trigger == 'timer' %}
+Wants={{ borg_prune_timer_name }}{{ "@" if borg_backup_argument != "" }}{{ borg_backup_argument }}.timer
+{% endif %}
+
+[Service]
+Type=oneshot
+ExecStart={{ borg_prune_script_location }}{{ "@" if borg_backup_argument != "" else "" }}{{ borg_backup_argument }}
+User={{ borg_client_user }}
+Group={{ borg_client_user }}
+{% if borg_prune_service_successful_exit_status | length > 0 %}
+SuccessExitStatus={{ borg_prune_service_successful_exit_status | join(' ') }}
+{% endif %}
+
+[Install]
+WantedBy=multi-user.target