start-borg-backups (503B)
1 #!/bin/bash 2 3 set -eu 4 5 if [ -z "${BORG_PASSPHRASE:-}" ] 6 then 7 echo "You need to set the BORG_PASSPHRASE in your environment before running this script!" 8 exit 1 9 fi 10 11 if [ -z "${1:-}" ] 12 then 13 echo "Usage: $0 <host/group> [ansible-playbook options...]" >&2 14 exit 1 15 fi 16 17 target=$1 18 shift 19 20 ansible-playbook \ 21 --verbose \ 22 --extra-vars "borg_passphrase={{ lookup('env', 'BORG_PASSPHRASE') }}" \ 23 --inventory inventories/default \ 24 --limit "$target" \ 25 playbooks/borg-start.yml \ 26 "$@" 27 28 exit 0