aboutsummaryrefslogtreecommitdiff
path: root/templates/backup.sh.j2
diff options
context:
space:
mode:
Diffstat (limited to 'templates/backup.sh.j2')
-rw-r--r--templates/backup.sh.j26
1 files changed, 6 insertions, 0 deletions
diff --git a/templates/backup.sh.j2 b/templates/backup.sh.j2
index a5a65c9..9ac8f1d 100644
--- a/templates/backup.sh.j2
+++ b/templates/backup.sh.j2
@@ -9,11 +9,17 @@ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export BORG_RSH="ssh -i /root/.ssh/borg"
{% for job in borg_jobs %}
+{% if job.pre_command is defined %}
+{{ job.pre_command }}
+{% endif %}
{% if job.command_to_pipe is defined %}
{{ job.command_to_pipe }} | borg create borg@{{ borg_server }}:/srv/borg/repos/{{ ansible_hostname }}::{{ job.name }}-{now} {{ job.path | default('-') }}
{% else %}
borg create borg@{{ borg_server }}:/srv/borg/repos/{{ ansible_hostname }}::{{ job.name }}-{now} {{ job.path }}
{% endif %}
+{% if job.post_command is defined %}
+{{ job.post_command }}
+{% endif %}
{% endfor %}
borg prune borg@{{ borg_server }}:/srv/borg/repos/{{ ansible_hostname }} {{ borg_prune_arguments }}