Skip to content

Instantly share code, notes, and snippets.

@cwood
Created December 18, 2012 14:38
Show Gist options
  • Save cwood/4328540 to your computer and use it in GitHub Desktop.
Save cwood/4328540 to your computer and use it in GitHub Desktop.

Revisions

  1. cwood created this gist Dec 18, 2012.
    15 changes: 15 additions & 0 deletions restart-salt-minions.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/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