Skip to content

Instantly share code, notes, and snippets.

@cwood
Created December 18, 2012 14:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwood/4328540 to your computer and use it in GitHub Desktop.
Save cwood/4328540 to your computer and use it in GitHub Desktop.
restart all salt minions
#!/bin/bash
SALTMINIONS=$(sudo salt-key -L | grep -v "Rejected:" | grep -v "Accepted Keys:" | grep -v "Unaccepted Keys:")
echo -n "Remote hosts [sudo] password: "
read -s remote_password
echo
for minion in $SALTMINIONS
do
echo "Connecting to $minion ... "
ssh -tt $minion "echo \"$remote_password\" | sudo -S -p '' /etc/init.d/salt-minion restart"
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment