aboutsummaryrefslogtreecommitdiff
path: root/templates/backup.sh.j2
diff options
context:
space:
mode:
authorJulien Dessaux2021-02-11 19:10:38 +0100
committerJulien Dessaux2021-02-11 19:10:38 +0100
commit6e49d2b6c76bdc11c42fb292f7bdafc95e492d51 (patch)
tree36d95d04f7ae47e75a4334f0b06c931d43b7d2d6 /templates/backup.sh.j2
parentFixed borg backups on openbsd (diff)
downloadborg-ansible-role-6e49d2b6c76bdc11c42fb292f7bdafc95e492d51.tar.gz
borg-ansible-role-6e49d2b6c76bdc11c42fb292f7bdafc95e492d51.tar.bz2
borg-ansible-role-6e49d2b6c76bdc11c42fb292f7bdafc95e492d51.zip
Revitalized the borg role
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 }}