Merge branch 'master' of https://git.paulbsd.com/paulbsd/paulbsd-salt
This commit is contained in:
commit
ffa1e0a1aa
@ -3,6 +3,10 @@ borg:
|
||||
enabled: true
|
||||
run_user: dkron
|
||||
working_dir: /opt/borg
|
||||
default_dirs:
|
||||
- bin
|
||||
- logs
|
||||
- scripts
|
||||
pip_pkgs:
|
||||
- borgbackup
|
||||
- llfuse
|
||||
|
@ -1,5 +1,6 @@
|
||||
---
|
||||
include:
|
||||
- dkron
|
||||
- .pkgs
|
||||
- .install
|
||||
- .config
|
||||
|
@ -5,7 +5,7 @@ borg-working-dir:
|
||||
- name: {{ borg.working_dir }}
|
||||
- mode: 0700
|
||||
|
||||
{% for dir in ['bin', 'logs', 'scripts'] %}
|
||||
{% for dir in borg.default_dirs %}
|
||||
borg-working-dir-{{ dir }}:
|
||||
file.directory:
|
||||
- name: {{ borg.working_dir }}/{{ dir }}
|
||||
|
@ -1,7 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
|
||||
trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM
|
||||
|
||||
backup_name="{{ key }}"
|
||||
|
||||
{% if job.mountpoint is defined -%}
|
||||
export MOUNTPOINT="{{ job.mountpoint|default('/mnt') }}"
|
||||
|
||||
if [[ $(mountpoint -q $MOUNTPOINT) -ne 0 ]]
|
||||
@ -10,9 +14,12 @@ then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
backup_name="{{ key }}"
|
||||
repo_path=${MOUNTPOINT}/borg
|
||||
{% else %}
|
||||
repo_path={{ job.sshrepo|default('localhost::tmp') }}
|
||||
{%- endif %}
|
||||
|
||||
export BORG_REPO=${MOUNTPOINT}/borg/${backup_name}
|
||||
export BORG_REPO=$repo_path/${backup_name}
|
||||
export BORG_PASSPHRASE='{{ job.password }}'
|
||||
|
||||
info "Starting backup"
|
||||
|
Loading…
Reference in New Issue
Block a user