From ae692c80716ef0f9edcf19b276798901fcaae7b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomislav=20Kopi=C4=87?= Date: Sat, 10 Feb 2024 12:25:20 +0100 Subject: [PATCH] Fix var names --- playbooks/install_borgbackup.yml | 10 +++++----- templates/borgbackup.j2 | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/playbooks/install_borgbackup.yml b/playbooks/install_borgbackup.yml index e0bb01b..bfb3dd2 100644 --- a/playbooks/install_borgbackup.yml +++ b/playbooks/install_borgbackup.yml @@ -2,9 +2,9 @@ - hosts: all become: yes vars: - borg.repo.path: /var/backup/backup.borg/ - borg.repo.encryption: none - borg.backup.paths: /etc/ /var/spool/ --exclude=*.log + borg_repo_path: "/var/backup/backup.borg/" + borg_repo_encryption: "none" + borg_backup_paths: "/etc/ /var/spool/ --exclude=*.log" tasks: - name: "Install borg backup" apt: @@ -12,9 +12,9 @@ state: latest - name: "Create backup repository" - ansible.builtin.command: borg init -e {{borg.repo.encryption}} {{borg.repo.path}} + ansible.builtin.command: borg init -e {{borg_repo_encryption}} {{borg_repo_path}} args: - creates: {{borg.repo.path}} + creates: {borg_repo_path} - name: "Configure backup script" ansible.builtin.copy: diff --git a/templates/borgbackup.j2 b/templates/borgbackup.j2 index b07de01..a4c19cf 100644 --- a/templates/borgbackup.j2 +++ b/templates/borgbackup.j2 @@ -1,11 +1,11 @@ #!/bin/bash # Borg repo location -REPOSITORY={{borg.repo.path}} +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}} # Clean old backups borg prune -v $REPOSITORY --keep-daily=3 --keep-weekly=2 --keep-monthly=12 echo "`date +[%F/%T]` Done!"