From 8201d5c9935082b2521274f50425b30bcd987f6f Mon Sep 17 00:00:00 2001 From: Jochen Welzel Date: Mon, 18 Jan 2021 18:06:13 +0100 Subject: [PATCH] copy ssh key to the right location --- scp_and_reload.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scp_and_reload.sh b/scp_and_reload.sh index da92af8..8105c5c 100644 --- a/scp_and_reload.sh +++ b/scp_and_reload.sh @@ -2,23 +2,23 @@ CHFILENAMES=$(git diff-tree --no-commit-id --name-only $DRONE_COMMIT) -mkdir .ssh -echo $PLUGIN_KEY > .ssh/id_rsa -chmod 600 .ssh/id_rsa +mkdir /root/.ssh +echo $PLUGIN_KEY > /root/.ssh/id_rsa +chmod 600 /root/.ssh/id_rsa echo "Changed files: $CHFILENAMES" for file in $CHFILENAMES; do if [[ $file == *"zone" ]]; then echo "SCP of $file started" - scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $file "$PLUGIN_USER"@"$PLUGIN_HOSTS":"$PLUGIN_TARGET"/$file + scp -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $file "$PLUGIN_USER"@"$PLUGIN_HOSTS":"$PLUGIN_TARGET"/$file if [ $? -ne 0 ]; then echo "SCP failed" 1>&2 exit 1 fi ZONE=$(echo $file | sed 's/\.zone//') echo "Reload $ZONE zone" - ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "PLUGIN_USER"@"$PLUGIN_HOSTS" nsd-control reload $ZONE + ssh -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "PLUGIN_USER"@"$PLUGIN_HOSTS" nsd-control reload $ZONE if [ $? -ne 0 ]; then echo "Reload of zone failed" 1>&2 exit 1