aboutsummaryrefslogtreecommitdiff
path: root/share/hydra/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'share/hydra/deploy')
-rwxr-xr-xshare/hydra/deploy35
1 files changed, 34 insertions, 1 deletions
diff --git a/share/hydra/deploy b/share/hydra/deploy
index 015f81a..ce8b148 100755
--- a/share/hydra/deploy
+++ b/share/hydra/deploy
@@ -55,7 +55,9 @@ hydra_install_package ansible rsync
#echo ' \/\/ \/ \/ \/ \/|__| \/ \/'
#echo ''
-# Deploy
+#
+# Deploy iterating over each node
+#
for node in $NODES; do
if [ -d "$node" ]; then
echo "Deploying to $node folder..."
@@ -232,3 +234,34 @@ EOF
fi
fi
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="$*"
+ fi
+ fi
+fi
+
+hydra $HYDRA ansible-playbook site.yml --limit $NODES