From 0052f1a782fe84a513258cee607578ef733aabd6 Mon Sep 17 00:00:00 2001 From: Jiri Broulik Date: Thu, 24 May 2018 11:18:00 +0200 Subject: [PATCH] parametrize restore backup_dir PROD-20195 Change-Id: Iee5811f3e83259bdd209b0e59641261bccbed6f6 --- maas/files/restore.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/maas/files/restore.sh b/maas/files/restore.sh index 121b1b4..b263a29 100644 --- a/maas/files/restore.sh +++ b/maas/files/restore.sh @@ -1,6 +1,7 @@ {%- from "maas/map.jinja" import region with context %} -{%- set database = region.get("database", {}) %} +{%- set backup_dir = pillar.get('backupninja', {}).get('client', {}).get('target', {}).get("home_dir", "/srv/backupninja") -%} +{%- set database = region.get("database", {}) -%} export PGHOST={{ database.get("host", "localhost") }} export PGUSER={{ database.get("username", "maas") }} @@ -18,11 +19,11 @@ export PGPASSFILE=/root/.pgpass mkdir -p {{ target }} -scp backupninja@{{ backupninja_host }}:/srv/backupninja/{{ backupninja_source }}/var/backups/postgresql/postgresql.{{ age }}/{{ source_name }} {{ target }}{{ dest_name }} +scp backupninja@{{ backupninja_host }}:{{ backup_dir }}/{{ backupninja_source }}/var/backups/postgresql/postgresql.{{ age }}/{{ source_name }} {{ target }}{{ dest_name }} gunzip -d -1 -f {{ target }}{{ dest_name }} -scp -r backupninja@{{ backupninja_host }}:/srv/backupninja/{{ backupninja_source }}/etc/maas/maas.{{ age }} /etc/maas -scp -r backupninja@{{ backupninja_host }}:/srv/backupninja/{{ backupninja_source }}/var/lib/maas/maas.{{ age }} /var/lib/maas +scp -r backupninja@{{ backupninja_host }}:{{ backup_dir }}/{{ backupninja_source }}/etc/maas/maas.{{ age }} /etc/maas +scp -r backupninja@{{ backupninja_host }}:{{ backup_dir }}/{{ backupninja_source }}/var/lib/maas/maas.{{ age }} /var/lib/maas sudo systemctl stop maas-dhcpd.service sudo systemctl stop maas-rackd.service