Today we will be dealing with some details of the parts involved. In my previous post - I explained the rationale behind the whole process.
So let us get into the schematics.
An ESX server can be installed with a kickstart script. There are multiple posts all over the web on how to configure this and customize the process. In a nutshell - most of the additional customization is performed in the %post section
Executes the specified script after package installation has been completed. If you specify multiple %post sections, they are executed in the order they appear in the installation script.
As I said in my previous post - one of the reasons for doing this was because there is no kickstart for ESXi, it is whole different process. Two of the best posts I have read are on this here and here
The way it works is that ESXi boot into a full ESXi environment from the ISO image. It then kicks off an install process to ask you for input:
- Which disk..
- etc. etc.
- Hey presto - you have an ESXi
It then formats the disk with VMFS and configures the boot partition to start off the ESX Kernel on the next boot. Andrew gives a much better explanation than I do so read the posts above.
Ok then what? you cannot perform any customization.
So the options (as I saw them) were:
- Dig into the Python Libraries in the installation source and customize the installation
That was not what I wanted because:
- The learning curve to learn a new language - not something I am up to at the moment.
- This would be good for the one installation but what about the subsequent installations. And if I want to make a change to the process, this did not seem viable to me.
- Take the customization process out of the installation and like the kickstart do it post installation.
Ok so how?
The solution I came up with was based on the solution provided by Lance Berc.
What Lance did was to provide a parameter to the PXE boot parameters including a variable called PBHOST which is an IP address
# # This code assumes that an argument has been passed via PXE which points # pbconnect to the configuration service. The format is PBHOST=<host:port> # and it goes just after the vmkernel.gz argument in the configuration line, # for example: # append vmkernel.gz PBHOST=192.168.2.253:3333--- binmod.tgz --- environ.tgz --- cim.tgz --- oem.tgz --- lance-boot.tgz # The vsish line is for compatibility with VI4. It should be conditional based on uname -a awk -f /sbin/pbconnect.awk /var/log/messages > /tmp/pb.tmp vsish -e get /system/bootCmdLine | awk -f /sbin/pbconnect.awk >> /tmp/pb.tmp #cat /tmp/pb.tmp source /tmp/pb.tmp if [ x$PBHOST != "x" ] ; then (pbconnect $PBHOST &) ; fi
What the process would do is look in the boot log. If it found the PBHOST in then it would fire-off a connection script. called pbconnect which is part of the lance-boot.tgz that was passed in the PXE boot.
Ok first my issues with the process:
- Not all installations are performed with PXE.
- The pbconnect is (i think) a compiled program - and I wanted something that could be customized and changed if needed.
On the other side there was a midwife script. This script consisted of Perl script that would listen for connections and once connected would fire off the customizations process (which is was a Powershell process)
I also had a few problems with this:
- Perl is not my cup or tea - I will leave this to William Lam
- In order for this to run I would have to have both Powershell and Perl on the machine.
- Why not do it all in one language? - my preference - Powershell.
So to recap slightly - the process was to run a script after installation, connect to a listener on another host and once the connection is made the "midwife would configure the machine.
This is I guess the was that VMware are moving forward seeing that they put this into Stateless VMware ESXi Server Version 3.5 Update 4 Using PXE Booting
This is already built into the VMkernel in starting from ESXi 3.5 U4 and in an ESX4i as you can see from the log of the ESXi host. This in the /var/log/messages
Apr 23 05:33:16 vmkernel: sysboot: Getting 'PBHOST' parameter from kernel boot line
Next post up - The Client and Server scripts.