From a8a4360fc7c158ef294384bc2471b732250523ab Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Mar 2021 10:05:53 +0100 Subject: [PATCH] [fix] Modifies the template to allow custom ports. Replaces/handles Hetzner specific scenario --- templates/borg-backup.sh.j2 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/templates/borg-backup.sh.j2 b/templates/borg-backup.sh.j2 index d2f19bb..e689930 100644 --- a/templates/borg-backup.sh.j2 +++ b/templates/borg-backup.sh.j2 @@ -15,8 +15,8 @@ if [ "$1" = "info" ] then if [ -z "$2" ]; then printf "run $0 with list and use the backup-tag to request information\n"; exit 1; fi {% for b in borgbackup_servers %} -{% if b.type == 'hetzner' %} - REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} +{% if b.port %} + REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:{{ b.port }}/{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} {% else %} REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} {% endif %} @@ -31,8 +31,8 @@ if [ "$1" = "mount" ] if [ -z "$3" ]; then printf "Select the backup to mount\n"; exit 1; fi if [ -z "$4" ]; then printf "Select the path to mount the backup on\n"; exit 1; fi {% for b in borgbackup_servers %} -{% if b.type == 'hetzner' %} - REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} +{% if b.port %} + REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:{{ b.port }}/{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} {% else %} REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} {% endif %} @@ -45,8 +45,8 @@ fi if [ "$1" = "list" ] then {% for b in borgbackup_servers %} -{% if b.type == 'hetzner' %} - REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} +{% if b.port %} + REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:{{ b.port }}/{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} {% else %} REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} {% endif %} @@ -59,8 +59,8 @@ fi if [ "$1" = "init" ] then {% for b in borgbackup_servers %} -{% if b.type == 'hetzner' %} - REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} +{% if b.port %} + REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:{{ b.port }}/{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} {% else %} REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} {% endif %} @@ -93,8 +93,8 @@ if [ "$1" = "backup" ] {% endif %} {% for b in borgbackup_servers %} -{% if b.type == 'hetzner' %} - REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} +{% if b.port %} + REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:{{ b.port }}/{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} {% else %} REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} {% endif %}