2023-10-10 12:40:22 +02:00
|
|
|
#!/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
|
|
|
|
|
2024-08-27 11:08:18 +02:00
|
|
|
restic backup --host="{{ inventory_hostname }}" --verbose \
|
2023-10-10 12:40:22 +02:00
|
|
|
/etc \
|
|
|
|
/home \
|
|
|
|
/opt \
|
|
|
|
/root \
|
|
|
|
/srv \
|
|
|
|
/var/www
|
|
|
|
|
|
|
|
echo "done! :)"
|