tumblr / collins

groovy kind of love
tumblr.github.com/collins
Apache License 2.0
573 stars 99 forks source link

Enhancement: ability to reset PXE boot on misconfigured servers #577

Open nshalman opened 6 years ago

nshalman commented 6 years ago

Ever found a bunch of machines that somehow got misconfigured and aren't set to PXE boot, but your IPMI access does appear to work?

Here's a gross hack. Pipe the list of affected asset tags to this abomination. while read tag; do collins find -c ipmi -t $tag; done | awk '{print $9,$21}' | sed 's|[,)]||g' | awk '{print "ipmitool -I lanplus -H",$1,"-P",$2,"-U root chassis bootdev pxe"}' | bash -x

Much better would be if collins or consolr could easily issue that IPMI chassis bootdev pxe command to them in a more standard way.

Should be very easy to add to consolr. Having it go via the collins server would of course provide better logging.

defect commented 6 years ago

Hey, sorry for not answering earlier. That does look like something that could be added to consolr (which now lives in it's own repo here: https://github.com/tumblr/consolr).

As for integration in collins i think the easiest would be to have it trigger on a state transition callback. Maybe have a state called Maintenance:FORCE_PXE and trigger the callback whenever an asset transitions in to that state? More info on callbacks here: http://tumblr.github.io/collins/configuration.html#callbacks

You could posisbly just add your ipmitool command there and not rely on consolr at all.