Mass Update Ubuntu (debian) servers without puppets or chefs


Ok, you do not want in invest the exorbitant fee for management and scripting though some fancy web based script engines like Puppet or Chef, but like us you so have this farm of a couple of dozen (or hundreds) of VM’s that at some point need their updates and patches, especially when these VM’s have been neglected for a couple of weeks during the summer vacations :).

Now how to go about this?

Firstly from your admin server or PC, copy your SSH cert to the target so that you can log in without password challenge, for this to work under root you need to give root a password, (log in as root on the target server sudo, and set a password with passwd) of course not advised, but very practical in most cases. 

Now to copy your ssh cert, simple issue the ssh-copy-id command followed by uid@ip (e.g. root@192.168.1.10) and authenticate.

Now make a file with IP’s (or hostnames) of the servers you want to manage, i call it servers.lst 

Then this little (very simple) script does the trick

while read name

do
echo “Processing : ” $name
ssh -n $name “DEBIAN_FRONTEND=noninteractive $1”
done < servers.lst

the -n after ssh makes ssh wait before it returns to shell, the DEBIAN_FRONTEND=noninteractive in the command suppresses some debconf warnings (as explained here)

Simply make executable (chmod +x) and run as ./script.sh ‘apt-get update && apt-get upgrade –yes’ (for example)

Sometimes, less is more..

How to install ESXi on those darn cheap-ass SanDisk Cruzer fit sticks


It took me some time to figure out, but for my next batch of ESXi hosts for our cloud platform I simply refused to go to the WanChai computer center again to buy new USB sticks, as I still had a batch of those SanDisk Cruzer Fit sticks lying around from my previous attempt. Last time, because of time constraints, I had to take the easy route and go and buy HP branded stuff for our army of BL495. But today we received another 16 or so 495’ers to fill up another enclosure, and as said, I refused to go out to the computer-center to buy sticks again, it bloody pouring out there 🙂

So I dug in to this and with a little help from google and the syslog logs, I figured it out, It seems that ESXi wan’t to format the USB stick with a GPT partition, which some sticks like these SanDisk Cruzers, won’t take. Now to force the installed to use classic MBR, upon install, on the boot screen press SHIFT-O for the boot options of runweasel.

Remove whatever you see there and just replace it with runweasel formatwithmbr press enter, and voila, your install will proceed, format the stick, install the binaries, and most important, boot from it on next reboot.