1
0
Fork 0

Ansible best practices and committed forgotten handlers for borg role

This commit is contained in:
Julien Dessaux 2019-07-15 20:40:00 +02:00
parent 5b953c8dba
commit dfc762b005
6 changed files with 23 additions and 5 deletions

View file

@ -1,4 +1,8 @@
#!/bin/sh
###############################################################################
# \_o< WARNING : This file is being managed by ansible! >o_/ #
# ~~~~ ~~~~ #
###############################################################################
echo '{'
if [ -e '/root/.ssh/borg.pub' ]; then

6
handlers/main.yml Normal file
View file

@ -0,0 +1,6 @@
---
- name: reload openbsd cron
service:
name: cron
state: reloaded
...

View file

@ -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 }}

View file

@ -1,4 +1,4 @@
---
borg_packages:
- 'borgbackup'
- borgbackup
...

View file

@ -1,4 +1,4 @@
---
borg_packages:
- 'app-backup/borgbackup'
- app-backup/borgbackup
...

View file

@ -1,4 +1,4 @@
---
borg_packages:
- 'borgbackup'
- borgbackup
...