diff options
-rwxr-xr-x | share/hydra/mass | 31 | ||||
-rwxr-xr-x | share/hydractl/puppet-reset-master | 2 |
2 files changed, 14 insertions, 19 deletions
diff --git a/share/hydra/mass b/share/hydra/mass index 64ad8e0..3aebd22 100755 --- a/share/hydra/mass +++ b/share/hydra/mass @@ -5,17 +5,12 @@ # Issue commands with pssh function mass_pssh { - echo "Issuing $COMMAND on multiple nodes..." - hydra_set_tmpfile nodes - echo $NODES > $TMPWORK - parallel-ssh -t 40 -P -h $TMPWORK sudo $COMMAND - hydra_unset_tmpfile $TMPWORK + parallel-ssh -t 120 -P -p 4 -h $TMPWORK sudo $COMMAND } # Issue commands with a for loop function mass_loop { - for node in $NODES; do - echo "Issuing $COMMAND on multiple nodes..." + for node in `cat $TMPWORK`; do echo "Connecting to $node..." $HYDRA_CONNECT $node sudo $COMMAND done @@ -23,20 +18,18 @@ function mass_loop { # Issue commands with dish function mass_dish { - echo "Issuing $COMMAND on multiple nodes..." - hydra_set_tmpfile nodes - echo $NODES > $TMPWORK dish -f -p /dev/null -e "sudo $COMMAND" -g $TMPWORK - hydra_unset_tmpfile $TMPWORK } # Issue commands with mussh function mass_mussh { - echo "Issuing $COMMAND on multiple nodes..." - hydra_set_tmpfile nodes - echo $NODES > $TMPWORK mussh -H $TMPWORK -c "sudo $COMMAND" - hydra_unset_tmpfile $TMPWORK +} + +# Set nodes +function set_nodes { + hydra_set_tmpfile nodes + hydra $HYDRA nodes $1 > $TMPWORK } # Load @@ -48,7 +41,8 @@ BASENAME="`basename $0`" COMMAND="$*" # Initial node list -NODES="`hydra $HYDRA nodes`" +BASEDIR="/tmp" +set_nodes # Validation if [ "$BASENAME" == "mass-update" ]; then @@ -56,9 +50,10 @@ if [ "$BASENAME" == "mass-update" ]; then elif [ "$BASENAME" == "mass-upgrade" ]; then COMMAND="aptitude safe-upgrade -y" elif [ "$BASENAME" == "mass-web" ]; then - NODES="`hydra $HYDRA nodes web`" + set_nodes web fi # Execute commands in hosts -BASEDIR="/tmp" +echo "Issuing $COMMAND on multiple nodes..." mass_pssh $COMMAND +hydra_unset_tmpfile $TMPWORK diff --git a/share/hydractl/puppet-reset-master b/share/hydractl/puppet-reset-master index ee1c888..5a4386e 100755 --- a/share/hydractl/puppet-reset-master +++ b/share/hydractl/puppet-reset-master @@ -19,5 +19,5 @@ chown -R puppet.puppet /etc/puppet/ # Start services /etc/init.d/puppetmaster start -sleep 10 +sleep 5 /etc/init.d/nginx start |