I'd like to Kickstart a couple dozen RHEL6/SL6 servers. However, some of these servers are different and I don't want to create a new ks.cfg file for each class of server.
Is there any way I can generate a Kickstart file dynamically on the fly, from a template?
For example, if I append a line like this to the Kernel:
APPEND ks=http://192.168.1.100/cgi-bin/ks.cgi ip=dhcp
Then the script ks.cgi can determine what host this is (Via the MAC address), and print out Kickstart options which are appropriate for that host. I could optionally override some options by passing parameters to the script, like this:
After we kickstart the server, we activate Cfengine/Puppet on this system and manage the system using our favorite Configuration Management product.
A roll-your-own solution is discussed in the O'Reilly book: Managing RPM-Based Systems with Kickstart and Yum, Chapter 3. Customizing Your Kickstart Install > Dynamic ks.cfg, which echos some of the comments in this thread:
To implement such a tool is beyond the scope of this Short Cut, but I can walk through the high-level design. Any such solution would mix a data store (the things that change) with a templating solution (the things that don’t change). The data store would hold the per-machine data, such as the IP address and hostname. You would also need a unique identifier, perhaps the hostname, such that you could pick up a given machine’s data. The data store could be a flat file, XML data, or a relational database such as PostgreSQL or MySQL.
In turn, to invoke the system, you pass a machine’s unique identifier as a URL parameter. For example:
boot: linux ks=http://your.kickstart.server/gen_config?host-server25
In this example, the CGI (or servlet, or whatever) generates a ks.cfg for the machine server25.
But where, oh where, is the code for ks.cgi?