From 6e49d2b6c76bdc11c42fb292f7bdafc95e492d51 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 11 Feb 2021 19:10:38 +0100 Subject: Revitalized the borg role --- templates/backup.sh.j2 | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'templates/backup.sh.j2') 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 }} -- cgit v1.2.3