This repository has been archived on 2023-12-26. You can view files and clone it, but cannot push or open issues or pull requests.
hypervisors/ansible/roles/borg/backup.yml.j2

20 lines
752 B
Django/Jinja

location:
source_directories:
- /mnt/thecloud
repositories:
- /mnt/backups/share
exclude_patterns:
- /mnt/thecloud/mastodon/system/cache
retention:
keep_daily: 7
keep_weekly: 4
keep_monthly: 6
hooks:
before_everything:
- virsh snapshot-create-as --domain tf-thecloud --name backup-thecloud --disk-only --quiesce --no-metadata --diskspec vda,snapshot=no --diskspec vdb,file=/kvm/snapshots/thecloud.qcow2
- guestmount -a /kvm/snapshots/thecloud.qcow2 -m /dev/sda1 --ro /mnt/thecloud
after_everything:
- guestunmount /mnt/thecloud && sleep 1
- virsh blockcommit tf-thecloud vdb --active --verbose --pivot
- rm /kvm/snapshots/thecloud.qcow2
- apprise --body="Backup succeeded!" {{ apprise_url }} || true