From 65338bde34ba9254534d17357a7e8122ef980d10 Mon Sep 17 00:00:00 2001 From: Mykola Malkov Date: Wed, 12 Sep 2018 12:01:29 +0300 Subject: [PATCH] TT#37257 Get ssh pub key from mgmt node We need it to be able to connect from mgmt node to installed one to run 'ngcp-initial-configuration'. Change-Id: Id907094ba2eae32c05ad8d42d8a504e498a57ad4 --- templates/scripts/includes/deployment.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index 94f41cb..aad066f 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -1452,6 +1452,18 @@ EOT fi fi +if [[ -n "${MANAGEMENT_IP}" ]] && "${RETRIEVE_MGMT_CONFIG}" ; then + echo "Retrieving public key from management node" + cat > "${TARGET}/tmp/retrieve_authorized_keys.sh" << EOT +#!/bin/bash +set -e +mkdir -p /root/.ssh +wget --timeout=30 -O /root/.ssh/authorized_keys "http://${MANAGEMENT_IP}:3000/ssh/id_rsa_pub" +chmod 600 /root/.ssh/authorized_keys +EOT + grml-chroot "${TARGET}" /bin/bash /tmp/retrieve_authorized_keys.sh +fi + case "$DEBIAN_RELEASE" in stretch) set_custom_grub_boot_options