Skip to content

Instantly share code, notes, and snippets.

@ctheune
Last active December 24, 2015 23:39
Show Gist options
  • Save ctheune/6882149 to your computer and use it in GitHub Desktop.
Save ctheune/6882149 to your computer and use it in GitHub Desktop.
MPSSH snippets that I used to force changes through our infrastructure in an emergency script: force r-up-on for a set of machines, speed up reboots and verify machines that have been updated.

Expediate a puppet run on all machines, with at most 30 working at once

mpssh -p 30 -f vms -s -u root -r runpuppet

Poll for machines currently running our puppet wrapper

mpssh -p 20 -f vms -s -E "pgrep -f run-update-puppet" | grep " -> "

Check for and trigger reboots for machines with new kernel

mpssh -p 20 -f vms -s -u root -E "list-maintenance | egrep '3\.10' && echo reboot needed"

mpssh -p 20 -f vms -s -u root -E "list-maintenance | egrep '3\.10' && reboot"

Poll for machines that have a new kernel activated

mpssh -p 20 -f vms -s -E "uname -a | grep 3.10"  
#!/bin/bash
/usr/local/sbin/run-update-puppet&
tail -f /var/log/genkernel.log /var/log/sysconfig.log /var/log/emerge.log&
wait %1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment