ansible/roles/unhb_backup_scripts/restic_scripts/templates/restic-backup_ENTWURF.sh

26 lines
891 B
Bash
Raw Normal View History

2023-10-10 12:40:22 +02:00
#!/bin/bash
source {{ restic_env_file }}
#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
{% if restic_execute_before is defined %}
{{ restic_execute_before }}
{% else %}
# restic_execute_before is not defined, to insert commands to run before the actual backup, please define the variable in the Ansible Playbook
{% endif %}
restic backup --verbose {{ restic_backup_paths }}
{% if restic_execute_after is defined %}
{{ restic_execute_after }}
{% else %}
# restic_execute_after is not defined, to insert commands to run before the actual backup, please define the variable in the Ansible Playbook
{% endif %}
echo "done! :)"