Add backup path in vars

This commit is contained in:
Tomislav Kopić 2024-02-10 12:17:06 +01:00
parent 198f7648d2
commit 46c3bd9258
2 changed files with 2 additions and 3 deletions

View File

@ -4,6 +4,7 @@
vars: vars:
borg.repo.path: /var/backup/backup.borg/ borg.repo.path: /var/backup/backup.borg/
borg.repo.encryption: none borg.repo.encryption: none
borg.backup.paths: /etc/ /var/spool/ --exclude=*.log
tasks: tasks:
- name: "Install borg backup" - name: "Install borg backup"
apt: apt:

View File

@ -2,12 +2,10 @@
# Borg repo location # Borg repo location
REPOSITORY={{borg.repo.path}} REPOSITORY={{borg.repo.path}}
# Example of remote repo
# REPOSITORY=ssh://backuper@192.168.1.100/{{borg.repo.path}}
echo "`date +[%F/%T]` Starting the backup" echo "`date +[%F/%T]` Starting the backup"
# Create backup # Create backup
borg create -v --compression lzma,6 --stats $REPOSITORY::$(date +%Y-%m-%d-%H:%M) /etc/ /var/spool/ --exclude=*.log borg create -v --compression lzma,6 --stats $REPOSITORY::$(date +%Y-%m-%d-%H:%M) {{borg.backup.paths}}
# Clean old backups # Clean old backups
borg prune -v $REPOSITORY --keep-daily=3 --keep-weekly=2 --keep-monthly=12 borg prune -v $REPOSITORY --keep-daily=3 --keep-weekly=2 --keep-monthly=12
echo "`date +[%F/%T]` Done!" echo "`date +[%F/%T]` Done!"