aboutsummaryrefslogtreecommitdiff
path: root/templates/backup.sh.j2
diff options
context:
space:
mode:
authorJulien Dessaux2019-07-15 20:40:00 +0200
committerJulien Dessaux2019-07-15 20:40:00 +0200
commitdfc762b0058cf4a9ef7337c7a0883e2c5a5c3c9d (patch)
tree6f468503635e8e6be3afbaad15d5cd163a1a96b3 /templates/backup.sh.j2
parentAdded borg backup role (diff)
downloadborg-ansible-role-dfc762b0058cf4a9ef7337c7a0883e2c5a5c3c9d.tar.gz
borg-ansible-role-dfc762b0058cf4a9ef7337c7a0883e2c5a5c3c9d.tar.bz2
borg-ansible-role-dfc762b0058cf4a9ef7337c7a0883e2c5a5c3c9d.zip
Ansible best practices and committed forgotten handlers for borg role
Diffstat (limited to 'templates/backup.sh.j2')
-rw-r--r--templates/backup.sh.j212
1 files changed, 10 insertions, 2 deletions
diff --git a/templates/backup.sh.j2 b/templates/backup.sh.j2
index a029080..6549fe2 100644
--- a/templates/backup.sh.j2
+++ b/templates/backup.sh.j2
@@ -1,11 +1,19 @@
#!/bin/sh
+###############################################################################
+# \_o< WARNING : This file is being managed by ansible! >o_/ #
+# ~~~~ ~~~~ #
+###############################################################################
+
+HOME=/root
+PATH=${PATH}:/usr/local/bin
+BORG_RSH="ssh -i /root/.ssh/borg"
{% 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 }}
+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 }}
+borg prune borg@{{ borg_server }}:/srv/borg/repos/{{ ansible_hostname }} {{ borg_prune_arguments }}