diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-05-23 16:45:09 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-05-23 16:45:09 -0300 |
commit | e925984f4e858d5e17b60615e992314cdaf50ba4 (patch) | |
tree | 0582968c4de61932b0a5b74aabaf16936ef71d82 /share | |
parent | 862d6d2b7e7038df7ec19781dec919693f69e76e (diff) | |
download | hydra-e925984f4e858d5e17b60615e992314cdaf50ba4.tar.gz hydra-e925984f4e858d5e17b60615e992314cdaf50ba4.tar.bz2 |
Deploy: import keys if needed
Diffstat (limited to 'share')
-rwxr-xr-x | share/hydra/deploy | 15 |
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 |