From b54710a72e1d8319f61e11c029c27bb321a63804 Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Mon, 10 Jun 2024 22:35:58 -0500 Subject: [PATCH] Use bash HOSTNAME var for backup scripts --- roles/backup/templates/s3backup.sh | 4 ++-- roles/backup/templates/s3restore.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/backup/templates/s3backup.sh b/roles/backup/templates/s3backup.sh index 5492582..9b373c2 100644 --- a/roles/backup/templates/s3backup.sh +++ b/roles/backup/templates/s3backup.sh @@ -63,7 +63,7 @@ backup() { {% if backup_s3_aws_endpoint_url is defined %} --endpoint-url="{{ backup_s3_aws_endpoint_url }}" \ {% endif %} - "s3://{{ backup_s3_bucket }}/{{ inventory_hostname }}/$dir/$(date "+{{ backup_dateformat }}").tar.gz" + "s3://{{ backup_s3_bucket }}/$HOSTNAME/$dir/$(date "+{{ backup_dateformat }}").tar.gz" } # Tar up all items in the backup list, recursively, and pipe them straight @@ -111,6 +111,6 @@ if command -v psql > /dev/null 2>&1; then {% if backup_s3_aws_endpoint_url is defined %} --endpoint-url="{{ backup_s3_aws_endpoint_url }}" \ {% endif %} - "s3://{{ backup_s3_bucket }}/{{ inventory_hostname }}/pgdump/$db/$(date "+{{ backup_dateformat }}").pgsql.gz" + "s3://{{ backup_s3_bucket }}/$HOSTNAME/pgdump/$db/$(date "+{{ backup_dateformat }}").pgsql.gz" done fi diff --git a/roles/backup/templates/s3restore.sh b/roles/backup/templates/s3restore.sh index 0217ec0..2244be3 100644 --- a/roles/backup/templates/s3restore.sh +++ b/roles/backup/templates/s3restore.sh @@ -20,7 +20,7 @@ # Please make any configuration changes in the main repo set -e -url="s3://{{ backup_s3_bucket}}/{{ inventory_hostname }}/" +url="s3://{{ backup_s3_bucket}}/$HOSTNAME/" # AWS S3 configuration # NOTE: THIS IS SECRET INFORMATION