Folks, looking for a bit of info.
We're scripting our install of ESX 3.0.1. I've created a KS.CFG file. We've tested the install and everyting works fine.
What we'd like to do is create a .CFG file for all of our hosts.
Is it possible to rename the CFG files as folllows?
esxhost1.cfg, esxhost2.cfg, esxhost3.cfg etc
Then when we go to run the install, type esx esxhost1=floppy method=cdrom
LOL! Thanks
You can certainly create multiple ks.cfg files for each host and specify the url to reach it with the ks=url parameter when you get to the boot prompt.
However, if most of your ks.cfg files are more or less identical it might be easier to have a single ks.cfg and have a script run the first time after being kickstarted. Using a firstboot script is quite a bit more flexible than doing things in the ks.cfg because ESX is running instead of the installer so the script can verify that things actually worked.
In our environment we currently have 74 ESX servers and I have 8 ks.cfg files that I have placed directly on the boot.iso which only differ depending on the ethernet interface the kickstart server is on (due to cabling differences between servers). This allows us to build the server by specifying only the interface to load from instead of the full esx command. I.E. it's a lot easier to remember "eth0" than "esx ks=http://kickstartserver.my.org/ESX/ks/esxcluster01.ks.cfg"
After the kickstart we have a script that asks for the cluster, how the system is cabled and the hostname then it configures the networking and dynamically builds a host file for the correct ESX cluster, patches the server, installs additional packages like Dell Openmanage and validates that all the packages installed, verifies that VT support is enabled in the bios, validates that the networking can communicate to the Virtual Center and the vmotion interfaces of the other cluster nodes, and verifies misc stuff like DNS resolution and NTP services are working and finally brings up the server.
---
RHCE, VCP
You have many options, I would suggest you google for and read the RedHat command-line options for the installer boot kernel. For example, esx text ks=hd:fd0/server1.cfg, where your hardware references floppy as fd0, or ks=hd:sdb/server2.cfg, where your hardware references usb flash drive as sdb. The ks=floppy defaults to ks.cfg by default, that does not mean you are limited to such.
Thanks for this guys. Apologies for not responding sooner but I've been on holiday.
I will review and get back to you ASAP.
BTW, the naming tricks for ks.cfg I noted before, work for network based kickstart/OEM OS loading as well, in such methods, you have all your CFG files on a network share via NFS for example.
Thanks guys.
Got the script working... but was just looking to understand the syntax when stroring the config file on the floppy and booting from a cd rom.
If I name the config file ks001.cfg....... should the command be esx ks=ks001.cfg method=cdrom ???
Apologies for the previous post. It was answered by Schorschi already.
Scripts now working fine.
LOL! Thanks
Thanks for all this info lads.
I'd like to be able to add a section to the end of my script that reconfigures the eth0 nic. I need to move it to the second onboard NIC.
Can anyone offer any guidence?
Can I ask why you want or need to do this?
Re- Post install script.
Since I am not a shell scripter, I wondering if I could get an example of your post install script or some direction on creating one.
Thanks,
Jon
In general, anything you can do in the COS under bash, you can do in %Pre or %Post in reference to shell syntax or shell specific commands. It is when you call on other binaries that may or may not be available at %pre or %post time that you have issues.
A good reference for bash scripting is the "Advanced Scripting Guide", goggle it, and you will see some good information and examples on general bash scripting. Some use 'sh' which is a similar form of script shell, that BASH grew out of.
I tend to write scripts in BASH, then import them into %Post, but I also only do in %Post what I absolutely MUST do. We wrote our own service (script) that runs after the first reboot of the ESX host to do all significant work. This allows for easier creation, testing and debugging, and avoids binding the OS load to the server configuration phases. As you move to more sophisticated methods for server provisioning there are some advantages to separating the initial OS load from the configuration sequence.
General rules for scripting are like programming rules...
Write functions/blocks of code to do real work if you need to do the same work over and over, it means a function is usually a good idea
Write code so only one entry and exit is done, this is a structured coding technique common to any coding environment
Write functions that do simple tasks, and leverage functions to create complex tasks
Write code in a consistent and well understood style
Remember, everyone has their own personal style of coding, so agree ahead of time what that style and approach should be, above all, be consistent
Document your code
These rules may seem a pain, but in a multiple person shop, it pays to follow them.
For example...
mkdir -p /mnt/cdrom
mount /tmp/cdrom /mnt/cdrom
cp -vR /mnt/cdrom/* /mnt/sysimage/tmp
umount /mnt/cdrom
Gets the job done... But...
declare -i STATUS=0
We are creating a directory, mounting it to the physical cd-rom
drive, and copying files, this is only done once for all files on
disc. We are lazy and never delete the directory because it is
toast after anaconda shuts down.
echo "Make Directory"
mkdir -p /mnt/cdrom
STATUS=$?
echo "Mount Disc"
mount /tmp/cdrom /mnt/cdrom
STATUS=$?
echo "Copy Files"
cp -vR /mnt/cdrom/* /mnt/sysimage/tmp
STATUS=$?
}
echo "Be nice to Anaconda... If you must"
umount /mnt/cdrom
}
echo "Result $" exit $
Tells you exactly where the script may have failed, and tells the next guy that may work on the automation scripting just exactly was expected and why when the script was designed. I am not telling you, in any way that what I said above is 100% perfect, only that a bit of thought and effort up front saves a lot of time debugging and scratching you head lafter.
That is great. I will play with it.
Thanks alot for your help.
Dominic, do you have a sample copy of the BOOT.MSG file that you use in the example on your website?
Failing that, does anyone have some sample text that I can use to create the BOOT.MSG file?
ie.... Type ESX01 to install ESX01 etc...
Thanks