aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/hydra/deploy76
1 files changed, 46 insertions, 30 deletions
diff --git a/share/hydra/deploy b/share/hydra/deploy
index 070f8cd..5e5a822 100755
--- a/share/hydra/deploy
+++ b/share/hydra/deploy
@@ -66,6 +66,12 @@ for node in $NODES; do
FOLDER=$node
hydra_deploy_setup folder $FOLDER || continue
+ # Make sure keys exists for this node
+ hydra $HYDRA newkeys $FQDN
+
+ # Ensure key availability
+ hydra $HYDRA eyaml $FQDN
+
if ! sudo -n true; then
echo "Please set passwordless sudo on localhost."
continue
@@ -117,6 +123,9 @@ for node in $NODES; do
# Setup deploy environment
hydra_deploy_setup || continue
+ # Make sure keys exists for this node
+ hydra $HYDRA newkeys $FQDN
+
# Ensure key availability
hydra $HYDRA eyaml $FQDN
@@ -153,6 +162,12 @@ for node in $NODES; do
# Setup deploy environment
hydra_deploy_setup remote $node || continue
+ # Make sure keys exists for this node
+ hydra $HYDRA newkeys $FQDN
+
+ # Ensure key availability
+ hydra $HYDRA eyaml $FQDN
+
# Check for passwordless connections
# http://stackoverflow.com/questions/3830508/check-if-passwordless-access-has-been-setup#3830680
if ! $HYDRA_CONNECT -o NumberOfPasswordPrompts=0 $FQDN true; then
@@ -238,38 +253,39 @@ done
#
# Deploy using ansible own iterator
#
-
-# Command line arguments
-NODES="$*"
-
-# Build node list
-#if [ -z "$NODES" ]; then
-# #NODES="`BACKEND=ansible hydra $HYDRA nodes | xargs | sed -e "s/^/'~(/" -e "s/ /|/g" -e "s/$/)'/`"
-# NODES="all"
-#else
-if [ ! -z "$NODES" ]; then
- # Check if first param is a node name, otherwise assume its a class
- if [ -z "$2" ]; then
- NODES="`BACKEND=ansible hydra $HYDRA nodes $1`"
-
- if [ -z "$NODES" ]; then
- NODES="`BACKEND=ansible hydra $HYDRA nodes $1'*'`"
- fi
-
- # It's a class
- if [ ! -z "$NODES" ] && [ "`echo $NODES | wc -w`" != "1" ]; then
- #NODES="`echo $NODES | xargs | sed -e "s/^/'~(/" -e "s/ /|/g" -e "s/$/)'/"`"
- NODES="$*"
+if [ -e "$HYDRA_FOLDER/ansible/ansible.cfg" ]; then
+ # Command line arguments
+ NODES="$*"
+
+ # Build node list
+ #if [ -z "$NODES" ]; then
+ # #NODES="`BACKEND=ansible hydra $HYDRA nodes | xargs | sed -e "s/^/'~(/" -e "s/ /|/g" -e "s/$/)'/`"
+ # NODES="all"
+ #else
+ if [ ! -z "$NODES" ]; then
+ # Check if first param is a node name, otherwise assume its a class
+ if [ -z "$2" ]; then
+ NODES="`BACKEND=ansible hydra $HYDRA nodes $1`"
+
+ if [ -z "$NODES" ]; then
+ NODES="`BACKEND=ansible hydra $HYDRA nodes $1'*'`"
+ fi
+
+ # It's a class
+ if [ ! -z "$NODES" ] && [ "`echo $NODES | wc -w`" != "1" ]; then
+ #NODES="`echo $NODES | xargs | sed -e "s/^/'~(/" -e "s/ /|/g" -e "s/$/)'/"`"
+ NODES="$*"
+ fi
fi
+ else
+ NODES="all"
fi
-else
- NODES="all"
-fi
-if [ ! -z "$NODES" ]; then
- if [ "$NODES" == "all" ]; then
- hydra $HYDRA ansible-playbook site.yml
- else
- hydra $HYDRA ansible-playbook site.yml --limit $NODES
+ if [ ! -z "$NODES" ]; then
+ if [ "$NODES" == "all" ]; then
+ hydra $HYDRA ansible-playbook site.yml
+ else
+ hydra $HYDRA ansible-playbook site.yml --limit $NODES
+ fi
fi
fi