Ansible best practices and committed forgotten handlers for borg role
This commit is contained in:
parent
5b953c8dba
commit
dfc762b005
6 changed files with 23 additions and 5 deletions
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
###############################################################################
|
||||||
|
# \_o< WARNING : This file is being managed by ansible! >o_/ #
|
||||||
|
# ~~~~ ~~~~ #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
echo '{'
|
echo '{'
|
||||||
if [ -e '/root/.ssh/borg.pub' ]; then
|
if [ -e '/root/.ssh/borg.pub' ]; then
|
||||||
|
|
6
handlers/main.yml
Normal file
6
handlers/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- name: reload openbsd cron
|
||||||
|
service:
|
||||||
|
name: cron
|
||||||
|
state: reloaded
|
||||||
|
...
|
|
@ -1,11 +1,19 @@
|
||||||
#!/bin/sh
|
#!/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 %}
|
{% for job in borg_jobs %}
|
||||||
{% if job.command_to_pipe is defined %}
|
{% 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_RSH="ssh -i /root/.ssh/borg" borg create borg@{{ borg_server }}:/srv/borg/repos/{{ ansible_hostname }}::{{ job.name }}-{now} {{ job.path | default('-') }}
|
||||||
{% else %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% 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 }}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
---
|
---
|
||||||
borg_packages:
|
borg_packages:
|
||||||
- 'borgbackup'
|
- borgbackup
|
||||||
...
|
...
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
---
|
---
|
||||||
borg_packages:
|
borg_packages:
|
||||||
- 'app-backup/borgbackup'
|
- app-backup/borgbackup
|
||||||
...
|
...
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
---
|
---
|
||||||
borg_packages:
|
borg_packages:
|
||||||
- 'borgbackup'
|
- borgbackup
|
||||||
...
|
...
|
||||||
|
|
Reference in a new issue