Skip to content

Instantly share code, notes, and snippets.

@gene1wood
Created January 31, 2014 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gene1wood/8724901 to your computer and use it in GitHub Desktop.
Save gene1wood/8724901 to your computer and use it in GitHub Desktop.
A parallel ssh command which checks the last chef run and runs it again if there was a problem.
# `get_hosts $stack` returns the ips of the instances in the named stack
# the "-t -t" extra-args works around the issue of running sudo without a tty
# the "--force-formatter" tells chef-solo to still output what it's doing even though it has no tty
stack=1234
pssh --host="`get_hosts $stack`" --timeout=0 --inline --par=10 --extra-args='-t -t -o StrictHostKeyChecking=no' --user=ec2-user 'if tail -1 /var/log/chef.log | grep FATAL; then sudo chef-solo -c /etc/chef/solo.rb -j /etc/chef/node.json --force-formatter; fi'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment