ansible/roles/unhb_backup_scripts/templates/restic-backup_unhb-proxmox-local.sh.j2

20 lines
511 B
Django/Jinja
Executable file

#!/bin/bash
source /opt/scripts/restic/restic.env
#We will have to find out whether or not we need to initialize the repo. A non-zero exit code indicates that it has not yet been initialized.
restic snapshots
if [ "$?" -eq "0" ]
then
echo "Repo is already initialized, no need to do that."
else
echo "We need to initialize the repo first." && restic init
fi
restic backup --host="{{ inventory_hostname }}" --verbose \
/etc \
/home \
/opt \
/root \
/srv \
/var/www
echo "done! :)"