From eab5ff4f0b6ad56c214465b522b5311553dee1ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomislav=20Kopi=C4=87?= Date: Sat, 10 Feb 2024 12:40:49 +0100 Subject: [PATCH] Split exclude and backup --- playbooks/install_borgbackup.yml | 3 ++- templates/borgbackup.j2 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/playbooks/install_borgbackup.yml b/playbooks/install_borgbackup.yml index e201dcb..9d4c386 100644 --- a/playbooks/install_borgbackup.yml +++ b/playbooks/install_borgbackup.yml @@ -5,7 +5,8 @@ borg_repo_path: "/var/backups/backup.borg/" borg_repo_encryption: "none" borg_script_install_path: "/opt/borgbackup.sh" - borg_backup_paths: "/ --exclude=*.log --exclude=*.log.gz --exclude=/proc/ --exclude=/dev/ --exclude=/run/ --exclude=/sys/ --exclude=/tmp/" + borg_backup_paths: "/" + borg_exclude_paths: "--exclude=*.log --exclude=*.log.gz --exclude=/proc/ --exclude=/dev/ --exclude=/run/ --exclude=/sys/ --exclude=/tmp/" tasks: - name: "Install borg backup" diff --git a/templates/borgbackup.j2 b/templates/borgbackup.j2 index a4c19cf..82efe68 100644 --- a/templates/borgbackup.j2 +++ b/templates/borgbackup.j2 @@ -5,7 +5,7 @@ REPOSITORY={{borg_repo_path}} echo "`date +[%F/%T]` Starting the backup" # Create backup -borg create -v --compression lzma,6 --stats $REPOSITORY::$(date +%Y-%m-%d-%H:%M) {{borg_backup_paths}} +borg create -v --compression lzma,6 --stats $REPOSITORY::$(date +%Y-%m-%d-%H:%M) {{borg_backup_paths}} {{borg_exclude_paths}} # Clean old backups borg prune -v $REPOSITORY --keep-daily=3 --keep-weekly=2 --keep-monthly=12 echo "`date +[%F/%T]` Done!"