From 8a9cd33504c1138bdeb661ad01c7fabee5ade84e Mon Sep 17 00:00:00 2001 From: Evangelos Foutras <evangelos@foutrelis.com> Date: Mon, 8 Aug 2022 08:03:18 +0300 Subject: [PATCH] borg_client: use absolute path to borg in borg_cmd Using plain "borg" resolves to /usr/local/bin/borg which is the wrapper for our main backup host. This causes the offsite backup to be executed with BORG_REPO set to the main backup destination. While the above doesn't cause any issues with the backup script/service, because borg invocations specify the backup destination as an argument, it's not ideal and/or correct. Adjust borg_cmd to include the full path of /usr/bin/borg, thus removing any ambiguity. --- roles/borg_client/defaults/main.yml | 4 ++-- roles/borg_client/templates/borg.j2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/borg_client/defaults/main.yml b/roles/borg_client/defaults/main.yml index 46dfe45bc..c12a4bd90 100644 --- a/roles/borg_client/defaults/main.yml +++ b/roles/borg_client/defaults/main.yml @@ -2,8 +2,8 @@ backup_hosts: - host: "ssh://u236610.your-storagebox.de:23" dir: "~/repo" suffix: "" - borg_cmd: "borg" + borg_cmd: "/usr/bin/borg" - host: "ssh://zh1905@zh1905.rsync.net:22" dir: "~/backup/{{ inventory_hostname }}" suffix: "-offsite" - borg_cmd: "borg --remote-path=borg1" + borg_cmd: "/usr/bin/borg --remote-path=borg1" diff --git a/roles/borg_client/templates/borg.j2 b/roles/borg_client/templates/borg.j2 index a8014f703..bcdd5c115 100644 --- a/roles/borg_client/templates/borg.j2 +++ b/roles/borg_client/templates/borg.j2 @@ -1,3 +1,3 @@ #!/bin/bash -BORG_REPO="{{ item['host'] }}/{{ item['dir'] }}" exec /usr/bin/{{ item['borg_cmd'] }} "$@" +BORG_REPO="{{ item['host'] }}/{{ item['dir'] }}" exec {{ item['borg_cmd'] }} "$@" -- GitLab