aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2019-07-16 12:04:53 +0200
committerJulien Dessaux2019-07-16 12:04:53 +0200
commit44ce83917219df1663658a572b21917eba326458 (patch)
tree9b2ed65b19a466b1b61ab4ddc93a458c8eb6d98c
parentAnsible best practices and committed forgotten handlers for borg role (diff)
downloadborg-ansible-role-44ce83917219df1663658a572b21917eba326458.tar.gz
borg-ansible-role-44ce83917219df1663658a572b21917eba326458.tar.bz2
borg-ansible-role-44ce83917219df1663658a572b21917eba326458.zip
Fixed borg cron not working on openbsd
-rw-r--r--handlers/main.yml4
-rw-r--r--tasks/client.yml1
-rw-r--r--templates/backup.sh.j28
3 files changed, 7 insertions, 6 deletions
diff --git a/handlers/main.yml b/handlers/main.yml
index fed8e07..9fbf697 100644
--- a/handlers/main.yml
+++ b/handlers/main.yml
@@ -1,6 +1,6 @@
---
-- name: reload openbsd cron
+- name: restart openbsd cron
service:
name: cron
- state: reloaded
+ state: restarted
...
diff --git a/tasks/client.yml b/tasks/client.yml
index b4c4b22..7eedbe7 100644
--- a/tasks/client.yml
+++ b/tasks/client.yml
@@ -86,4 +86,5 @@
line: '0 23 * * * /usr/local/bin/adyxax_backup.sh'
path: /var/cron/tabs/root
when: ansible_os_family == 'OpenBSD'
+ notify: restart openbsd cron
...
diff --git a/templates/backup.sh.j2 b/templates/backup.sh.j2
index 6549fe2..89fcccb 100644
--- a/templates/backup.sh.j2
+++ b/templates/backup.sh.j2
@@ -4,13 +4,13 @@
# ~~~~ ~~~~ #
###############################################################################
-HOME=/root
-PATH=${PATH}:/usr/local/bin
-BORG_RSH="ssh -i /root/.ssh/borg"
+export HOME=/root
+export PATH=${PATH}:/usr/local/bin
+export 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('-') }}
+{{ 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 %}