No description
Find a file
freesker a4850c8408 🐛 treat borg warnings (rc=1) as success
Files changing during backup (e.g. active log files) cause borg to exit
with rc=1 but the archive is still created successfully. Accept rc=1 so
the daily backup no longer fails on live Nextcloud logs.
2026-04-12 23:37:16 +02:00
main.yml 🐛 treat borg warnings (rc=1) as success 2026-04-12 23:37:16 +02:00
README.md add variable to set ssh port 2023-03-16 19:53:35 +01:00

Backup with borg

This playbook will backup a local folder on a remote server using borg. Borg must be installed on the remote server. Old backups will be pruned. 7 backups will be kept daily, 4 weekly, 6 monthly and 2 yearly.

Usage example

With ansible

ansible-playbook borg-backup/main.yml \
    -e "ssh_connection=myserver@backup_user" \
    -e "ssh_port=22" \
    -e "private_key_path=/path/to/private/key" \
    -e "borg_repo_path=/home/backup_user/borg_repositories" \
    -e "borg_repo_name=folder_to_backup" \
    -e "borg_passphrase=wHaTever" \
    -e "local_folder=/var/backup/folder_to_backup"

Use a docker image to run this playbook periodically

This can be useful to backup docker volumes using borg features. See https://git.deditoolbox.fr/freesker/docker-borgbackup-cron.git