[fix] Modifies the template to allow custom ports. Replaces/handles Hetzner specific scenario

This commit is contained in:
root 2021-03-10 10:05:53 +01:00
parent 5ac24196dc
commit a8a4360fc7

View File

@ -15,8 +15,8 @@ if [ "$1" = "info" ]
then then
if [ -z "$2" ]; then printf "run $0 with list and use the backup-tag to request information\n"; exit 1; fi 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 %} {% for b in borgbackup_servers %}
{% if b.type == 'hetzner' %} {% if b.port %}
REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:{{ b.port }}/{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
{% else %} {% else %}
REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
{% endif %} {% endif %}
@ -31,8 +31,8 @@ if [ "$1" = "mount" ]
if [ -z "$3" ]; then printf "Select the backup to mount\n"; exit 1; fi 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 if [ -z "$4" ]; then printf "Select the path to mount the backup on\n"; exit 1; fi
{% for b in borgbackup_servers %} {% for b in borgbackup_servers %}
{% if b.type == 'hetzner' %} {% if b.port %}
REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:{{ b.port }}/{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
{% else %} {% else %}
REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
{% endif %} {% endif %}
@ -45,8 +45,8 @@ fi
if [ "$1" = "list" ] if [ "$1" = "list" ]
then then
{% for b in borgbackup_servers %} {% for b in borgbackup_servers %}
{% if b.type == 'hetzner' %} {% if b.port %}
REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:{{ b.port }}/{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
{% else %} {% else %}
REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
{% endif %} {% endif %}
@ -59,8 +59,8 @@ fi
if [ "$1" = "init" ] if [ "$1" = "init" ]
then then
{% for b in borgbackup_servers %} {% for b in borgbackup_servers %}
{% if b.type == 'hetzner' %} {% if b.port %}
REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:{{ b.port }}/{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
{% else %} {% else %}
REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
{% endif %} {% endif %}
@ -93,8 +93,8 @@ if [ "$1" = "backup" ]
{% endif %} {% endif %}
{% for b in borgbackup_servers %} {% for b in borgbackup_servers %}
{% if b.type == 'hetzner' %} {% if b.port %}
REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:{{ b.port }}/{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
{% else %} {% else %}
REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }} REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
{% endif %} {% endif %}