Setup backup server configuration for backup replication.
This commit is contained in:
1 parent
768da9cf45
commit
692e199868
9 files changed
+249
-12
No files matched your search
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
BORGUSER="{{ backup_owner }}";
|
||||
RUNFOLDER="{{ backup_storage }}";
|
||||
APPLIST="{{ backup_clients | json_query('*.app') | join(' ') }}"
|
||||
|
||||
declare -A BORG_CLIENT_MAP
|
||||
{% for client in backup_clients %}
|
||||
BORG_CLIENT_MAP[{{ backup_clients[client].app }}]="{{ client }}"
|
||||
{% endfor %}
|
||||
|
||||
declare -A BORG_USER_MAP
|
||||
{% for client in backup_clients %}
|
||||
BORG_USER_MAP[{{ backup_clients[client].app }}]="{{ backup_clients[client].owner }}"
|
||||
{% endfor %}
|
||||
|
||||
for APP in $APPLIST;
|
||||
do
|
||||
REPOSITORYCLIENT=${BORG_CLIENT_MAP[$APP]}
|
||||
BORG_REPO_USER=${BORG_USER_MAP[$APP]}
|
||||
REPOLOCATION="ssh://$BORG_REPO_USER@{{ backup_host }}:{{ backup_ssh_port }}/./$APP"
|
||||
BORG_PASSPHRASE=$(cat {{ backup_key_folder }}/$APP)
|
||||
BORG_RSH="ssh -i {{ backup_home }}/.ssh/$REPOSITORYCLIENT"
|
||||
sudo -H -u $BORGUSER bash -c '
|
||||
BORG_PASSPHRASE='$BORG_PASSPHRASE';
|
||||
BORG_RSH='$BORG_RSH';
|
||||
REPOLOCATION='$REPOLOCATION';
|
||||
borg list $REPOLOCATION'
|
||||
done
|
||||
Reference in new issue
Block a user