add a template for the restic backup script

This commit is contained in:
Andreas Zweili 2021-11-15 16:50:19 +01:00
parent 49fd52e235
commit 473ea09f55
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#!/bin/bash
export RESTIC_REPOSITORY=sftp:borg@10.7.89.117:restic
export RESTIC_PASSWORD={{ restic_password }}
if [ $(hostname) == management ]
then
restic backup /home/andreas --exclude-file=/home/andreas/.config/restic/excludes.txt
fi
if [ $(hostname) == {{ ansible_facts['hostname'] }} ]
then
cd {{ docker_project_path }}
sudo docker-compose pause
sudo -E restic backup /home/ansible --exclude-file=/home/ansible/.config/restic/excludes.txt
fi
if [[ -x /usr/local/bin/docker-compose || -x /usr/bin/docker-compose ]]
then
sudo docker-compose unpause
fi