aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydra/deploy15
1 files changed, 15 insertions, 0 deletions
diff --git a/share/hydra/deploy b/share/hydra/deploy
index 32dc700..63ff54e 100755
--- a/share/hydra/deploy
+++ b/share/hydra/deploy
@@ -84,6 +84,11 @@ for node in $NODES; do
echo "Applying configuration..."
LC_ALL=C HOSTNAME=$FQDN FACTER_domain=$DOMAIN FACTER_hostname=$FQDN FACTER_fqdn=$HOSTNAME.$DOMAIN $DEPLOY_APPLY 2>&1 | \
tee $HYDRA_FOLDER/puppet/logs/$FQDN.`date +%Y%m%d%H%M`.log
+
+ # Check if keys should be imported
+ if ! $SUDO test -f $FOLDER/root/.ssh/id_rsa; then
+ echo "No $FOLDER/root/.ssh/id_rsa found. Please import it and other keys when the system is online using import-keys action"
+ fi
elif [ "$node" == "localhost" ] || [ "$node" == "`facter fqdn`" ] || [ "$node" == "`facter hostname`" ]; then
echo "Deploying to localhost..."
@@ -118,6 +123,11 @@ for node in $NODES; do
# Fix ssl folder ownership
$SUDO chown -R `whoami`. $HYDRA_FOLDER/puppet/ssl
+
+ # Import keys if needed
+ if ! $SUDO test -f /root/.ssh/id_rsa; then
+ hydra $HYDRA import-keys localhost
+ fi
else
echo "Deploying to $node..."
@@ -196,5 +206,10 @@ EOF
echo "Applying configuration..."
$DEPLOY_APPLY 2>&1 | \
tee $HYDRA_FOLDER/puppet/logs/$FQDN.`date +%Y%m%d%H%M`.log
+
+ # Import keys if needed
+ if ! $HYDRA_CONNECT $FQDN sudo test -f /root/.ssh/id_rsa; then
+ hydra $HYDRA import-keys localhost
+ fi
fi
done