aboutsummaryrefslogtreecommitdiff
path: root/templates/backup.sh.j2
diff options
context:
space:
mode:
authorJulien Dessaux2019-07-09 11:45:03 +0200
committerJulien Dessaux2019-07-09 13:23:47 +0200
commit5b953c8dba0d7d4be10f93dfa10da975e5be1294 (patch)
tree2614f898ee114b77a1f7d3ef2af28e1724902747 /templates/backup.sh.j2
downloadborg-ansible-role-5b953c8dba0d7d4be10f93dfa10da975e5be1294.tar.gz
borg-ansible-role-5b953c8dba0d7d4be10f93dfa10da975e5be1294.tar.bz2
borg-ansible-role-5b953c8dba0d7d4be10f93dfa10da975e5be1294.zip
Added borg backup role
Diffstat (limited to '')
-rw-r--r--templates/backup.sh.j211
1 files changed, 11 insertions, 0 deletions
diff --git a/templates/backup.sh.j2 b/templates/backup.sh.j2
new file mode 100644
index 0000000..a029080
--- /dev/null
+++ b/templates/backup.sh.j2
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+{% for job in borg_jobs %}
+{% if job.command_to_pipe is defined %}
+{{ job.command_to_pipe }} | BORG_RSH="ssh -i /root/.ssh/borg" borg create borg@{{ borg_server }}:/srv/borg/repos/{{ ansible_hostname }}::{{ job.name }}-{now} {{ job.path | default('-') }}
+{% else %}
+BORG_RSH="ssh -i /root/.ssh/borg" borg create borg@{{ borg_server }}:/srv/borg/repos/{{ ansible_hostname }}::{{ job.name }}-{now} {{ job.path }}
+{% endif %}
+{% endfor %}
+
+BORG_RSH="ssh -i /root/.ssh/borg" borg prune borg@{{ borg_server }}:/srv/borg/repos/{{ ansible_hostname }} {{ borg_prune_arguments }}