Cobbler and the HP SmartStart Scripting Toolkit #2

Cobbler and the HP SmartStart Scripting Toolkit was a quick example of getting the SSSTK set up to boot via Cobbler. This post will add the ability to automatically register the system with cobbler and assign it to a hardware-specific profile. When you have a bunch of systems automatically added to Cobbler, you will just have to apply those configurations that make each host unique (like hostname and IP address).

Once this step is mastered, we can go a bit further in the next post and add customization of the BIOS, BMC, and RAID configurations.

The methods being used here, with separate directories for each tool, allow for, well… separation. You could make one directory, download all the RPMs, extract them, and create one big script to copy them to the booted SSSTK environment. The below method better allows for upgradability, separates out dependencies, and is self-documenting.


  • Instructions in the first post were followed.
  • Tools like wget and rpm2cpio are installed.
  • Your workflow for kickstarting systems is a little more complex than: netboot the new server, pick a Cobbler menu item, enjoy your new system. *

* My $EMPLOYER uses multiple hardware models and configurations for a single application. We roll an entire cabinet of new hardware into our datacenter and then power it all up. Our workflow allows for discovery and classification of the hardware models and looks like: netboot the new server (preferably this is the default on new hardware); automatically boot to a default discovery + configuration + regisitration profile; once they appear in Cobbler, manually assign Hostname/IP Address/Kickstart Metadata to each system; wait for each system to reboot and load OS; puppet picks up OS configuration and application installation; enjoy our new systems.

Set up some directories for future use:

cd /srv/nfs/ro/sstk-8.50/
mkdir addons

First, we are going to prepare the addons that do not ship with the SSSTK.

cd addons

Create an install tree for koan. This tool provides cobbler-register which is the whole point of this exercise.

mkdir koan
cd koan
cat <<EOF >create
cd \`dirname \$0\`
rpm2cpio koan-2.0.11-2.el5.noarch.rpm | cpio -idmv ./usr/bin/* ./usr/lib/python2.4/*
rpm2cpio python-urlgrabber-3.1.0-6.el5.noarch.rpm | cpio -idmv ./usr/bin/* ./usr/lib/python2.4/*
rpm2cpio rhpl-0.194.1-1.i386.rpm | cpio -idmv ./usr/lib/python2.4/*
chmod +x create

cat <<EOF >install
cd \`dirname \$0\`
for X in usr/bin/* usr/lib/python2.4/site-packages/*; do
  #cp -p \${X} /\${X}
  ln -s \${X} /\${X}
chmod +x install
cd ..

Next, we are going to create some scripts to automate discovery of hardware and register with Cobbler.

cd ../scripts

This script will register with Cobbler. This script is based on one of the examples that came with the SSSTK like scripts/

cat <<EOF >

### Get common variables variables
### must use absolute path here
### exit if file not found
if [ -f /TOOLKIT/includes ]; then
        source /TOOLKIT/includes
        echo -e "\n*** include file not found ***\n"
        exec /bin/bash

## Site Variables, do modify
export TZ=MST7
export TOOLKIT_WRITE_DIR=/srv/nfs/rw/sstk

## Internal Variables, do not modify

if ! echo "\$PRODUCT_NAME" | grep -q ProLiant; then
  echo "**************************************************"
  echo "**************************************************"
  echo "**************************************************"
  echo "WARNING: This is not a known hardware.  Halting..."
  echo "**************************************************"
  echo "**************************************************"
  echo "**************************************************"
  echo "\$PRODUCT_NAME"
  #exec /bin/bash

  # FIXME to do something useful with non-HP hardware.

echo ""
echo "*******************************************"
echo "*** Performing new Hadoop platform prep ***"
echo "*******************************************"
cd \${TOOLKIT}


echo "** Setting date and time from network"
hwclock --systohc --utc


echo ""
echo "** Registering with cobbler"
# SSSTK already removes spaces from Proliant names, but not VMware.
PRODUCT_LNAME=\`echo \$PRODUCT_LNAME | sed -e 's| ||g'\`
# PRODUCT_LNAME = ProLiantSL170zG6, ProLiantDL360G6, etc.
echo "** Registering to profile \${cprofile}-\${PRODUCT_LNAME}"
cobbler-register --batch --server=\${TOOLKIT_SERVER_IP} --profile=\${cprofile}-\${PRODUCT_LNAME} --fqdn=\${SERIAL_ID}
echo ""
cd \${TOOLKIT}


echo ""
echo "** Rebooting"
sleep 5
/bin/reboot pxe
chmod +x

Create another Cobbler profile with specific details about your application:

sudo cobbler profile add --name=sstk-8.50-install_yourapp \
--parent=sstk-8.50-shell --enable-menu=yes \
--kopts ' cprofile=yourapp !locale !url !hostname !domain !suite'

Then create separate profiles for each hardware type that you will be registering with Cobbler. This allows you to set hardware-specific items like the kickstart file that will be used to load the OS.

sudo cobbler profile add --name=yourapp-ProLiantDL360G6 \
--distro=CentOS6.2-x86_64 \
--kickstart=/var/lib/cobbler/kickstarts/yourapp_hpdl360g6.ks \
--comment="HP ProLiant DL360 G6" --enable-menu=no
sudo cobbler profile add --name=yourapp-ProLiantSL170zG6 \
--distro=CentOS6.2-x86_64 \
--kickstart=/var/lib/cobbler/kickstarts/yourapp_hpsl170zg6.ks \
--comment="HP ProLiant SL170z G6" --enable-menu=no

Now when you power up your new HP on a Cobbler-managed network and manually choose the sstk-8.50-install_yourapp Cobbler menu item, you will end up with a system registered to the correct hardware profile with all of it’s NIC MAC addresses programmed in Cobbler. From that point, you can add IP addresses and hostname details, enable Netboot, and your OS will start loading.

cobbler system edit --name=SERIALNUMBER --netboot-enabled \
--ip= --hostname=MyNewHost

About Michael Arnold
This is where I write about all of my unix hacking experiences so that you may be able to learn from my troubles.

One Response to Cobbler and the HP SmartStart Scripting Toolkit #2

  1. Pingback: Confluence: Deployment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: