Add borg backup role
This commit is contained in:
18
roles/borg_client/templates/create_job.sh.j2
Normal file
18
roles/borg_client/templates/create_job.sh.j2
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
export BORG_RSH="ssh -i {{ borgbackup_client_ssh_key_file }}"
|
||||
export BORG_PASSPHRASE="{{ borgbackup_passphrase }}"
|
||||
|
||||
REPOSITORY={{ borgbackup_server_user }}@{{ borgbackup_client_backup_server_lanfreebackup | default(borgbackup_client_backup_server) }}:{{ item.name }}
|
||||
|
||||
{{ borgbackup_binary }} create --show-rc --verbose --stats \
|
||||
{{ item.options | default('--compression zlib,6') }} \
|
||||
$REPOSITORY::{{ ansible_hostname }}-$(date +%Y-%m-%d_%H-%M) \
|
||||
{{ item.directories | join(' ') }} \
|
||||
{% for e in item.excludes %}
|
||||
--exclude '{{ e }}' \
|
||||
{% endfor %}
|
||||
2>&1 | tee {{ borgbackup_client_lastlog_dir }}/{{ item.name }}_{{ create_suffix_script_filename }}.lastlog \
|
||||
| /usr/bin/logger -t borgbackup_backup_{{ item.name }}_{{ borgbackup_client_backup_server }}
|
||||
Reference in New Issue
Block a user