Autoinstall by DVD
Auto Magic System Deployments Without a NetworkSomewhere between NetInstall and touching every machine with a set of DVDs lies the ability to do automated installs with almost no infrastructure. This article will walk you through setting up a deployment methodology which any monkey could use.
I've got a few Xserve Cluster Nodes in my lab that I do a lot of my experimentation on. They're great machines. Good bang for the buck, but... They are a total bugger to reimage. Or at least they used to be.
None of the cluster nodes have video cards. They're filled up with Fibre Channel HBAs, extra gigabit ports and internal RAID cards. There's no free ports on the KVM, even if I did have video cards in them. Normally this isn't an issue at all, except for when I hose one of them up real good and need to nuke and pave the OS back into something that will boot.
I first did this by booting them in target disk mode and installing using the DVD drive in a laptop or other machine. That works, but you have to make sure that the hardware monitoring is enabled in /etc/hostconfig and other concerns since you didn't actually install the system on Xserve hardware.
Another method I had working for a while was a NetRestore server and I'd NetBoot the afflicted machine and then image it. However, with the half-dozen images I use, this also got to be a pain trying to set the default image all the time. Plus I ended up always commandering the NetRestore box and hosing that too.
Finally after spending way too much time futzing with cables and stacks of unlabeled Apple Drive Modules, I've started using an automated installation method that even a monkey like me can use without having to think.
If you caught my WWDC session in 2005 on scripting, I mentioned this a bit there. And yes I know I should have posted this a long time ago...
Overview
This process involves the use of a boot device. In this case a firewire harddrive but it could easily be a bootable DVD or NetBoot image or even an big honkin' USB thumb drive on a newer Intel machine.
This device has a basic OS X Server install on it, but modified with a startup item or /etc/rc.cdrom that will prep the target machine for taking a new image. Then image the target machine with one of a number of disk images on the boot device. Then the startup device will be set to the target machine and rebooted.
All of the images have a self-destructing startup item that will look in either a local configuration file, or on external storage for what to set the IP, hostname, serial number and other settings to force on the system.
Finally a last reboot of the target system and you're off to the races with a brand spanking new system.
The real genius of this setup is that it actually requires no user interaction whatsoever. I use the front panel mode on the Xserve to get it to boot off of anything but the internal drive I keep a default config file in the image, which can be overridden by an external file.
No keyboard, no monitor, and you only need two fingers to get into front panel mode! What could be easier?
Boot Device Setup
First off you need something to boot the target system from. The quickest way to do this is to image an installer DVD. I usually use an OS X Server installer DVD but you should be able to use a client one if you'd like.
Make a read/write disk image of the DVD. Mount it and remove the contents of /System/Library/Installation, making sure to leave the Installation folder itself. This should give you a very minimal boot system of just a few hundred MB. This means you can image this back to a DVD and still have 4 GB or more of storage for disk images. If you're using a firewire drive, space probably isn't an issue, so this isn't as big of a deal.
Now we need to slip our script into this image. To keep things clean I'll create a directory to stash all of my customizations in. In this case we'll use /opt/afp548. All of the scripts and disk images are going to go in there.
The first script that we're going to use, AMInstall.bash which you can find in the script package for this in our downloads section, is the one that will format/parition the drive and blast the image down onto the new volume.
Apple makes it easy for us to call a custom pre-install script from the /etc/rc.cdrom script that is used to begin the boot process, as it has a line in there to call an /etc/rc.cdrom.preWS script before the installation is actually started. Depending on my mood I sometimes create an alias between that location and my install script. Other times I edit the rc.cdrom file to call my script instead of rc.cdrom.preWS. I usually prefer the latter, but it's all a matter of style. Sometimes you feel like a nut...
So edit these lines in /etc/rc.cdrom on the DVD image you're working with to call your script.
# # Source a pre-WindowServer script if present # (This is inaccurate, the WindowServer is now started on demand.) # if [ -x /etc/rc.cdrom.preWS ]; then /etc/rc.cdrom.preWS fiWhen you're done it'll look something like this (make sure to keep the humorous comment of course):
# # Source a pre-WindowServer script if present # (This is inaccurate, the WindowServer is now started on demand.) # if [ -x /opt/afp548/AMInstall.bash ]; then /opt/afp548/AMInstall.bash fiNow for what the AMInstall script does.
First of all it will get a list of all mounted devices, minus the boot device. It will make a RAID 1 set from bays 1 and 2. Then it will blast your disk image onto it. It will then make the newly imaged drive your boot system. Finally it will log what it did.
Your disk image should have the AMConf.bash file setup as a startup/launchd item. If done correctly this should ensure that upon reboot this script will run and look for a pre-installed config file or a volume called AMSData with a config file on it. The AMData volume can easily be a USB thumb drive or another firewire drive. The script could also easily be altered to pull this information from a web server or other network service.
The script will use the config file to read in the IP address, hostname, and other setup information for this system based upon it's hardware serial number. When it's finished it will delete itself and reboot the system.
You should now have a fully configured and useable server system without having to be present for the install.
Note that the scripts included will probably need a bit of work on your part to customize for your environment. However they should be decently commented enough to allow you to do that. You can get them from our downloads section.
(That bit about the internal RAID on the cluster node was a joke, bonus points if you caught it)
