Cobbler

Redhat's Cobbler project https://fedorahosted.org/cobbler/ provides a fairly lightweight management layer on top of tools used for Redhat installs such as kickstart, PXE, DHCP, Yum. What Cobbler does is somewhat similar to what ROCKS does, but Cobbler is more lightweight and ROCKS is better suited to tightly integrated clusters.

Here, I use a subset of the Cobbler functionality to manage installs of Desktop machines on a campus network.

Cobbler will be used to generate a CD iso image that includes kickstart files to drive a network install for each of the desktop computers in our cluster. For an install to proceed, only the generated CD and http access to the Scientific Linux RPMs will be needed. For our network setup this is a convenient and secure setup. On our network we can't have control over the DHCP and DNS servers, so we can't make use of PXE booting. Also, I don't wish to serve out the kickstart files on the network as the network is not controlled so there may be a security issue there. So we use CDs to get the kickstart files to the computes and only download the standard RPM files over the network.

This usage is slightly different from how cobbler works, we'll have to modify cobbler slightly for this use (the changes are pretty simple, a few lines of code are commented out here an there). The kickstart templating and ISO generation parts of Cobbler are useful. They mean that like parts of the install can be shared between machines and that machine configurations can be recorded/controlled centrally.

When a machine needs to be built, the process is straight forward: ensure that the templated kickstart covers the machine (it will be very similar to existing kickstarts), use the cobbler command to generate an ISO, burn the ISO to a CD-RW, boot the CD-RW in the node, select the node name from the menu and let the build proceed. The CD-RW will have all the information needed to build the node, only the software RPMs will need to be retrieved over the network.

Cobbler has a similar work flow that is completely in which the ISO image contains all the needed RPMs, but this ISO is big enough that a DVD is required and not all of our machines have DVD readers (and DVD writers are also rare), so the mixed design of having the boot and configuration files put on the ISO, but having the RPMs downloaded via over the net is useful.

References

Local:

Changes to Cobbler

Here are some alterations to cobbler for our use.

Importing SL Distro

Cobbler knows about official Redhat distro directory structures and CentOS, but about Scientific Linux. When importing a Scientific Linux distro, you might see the error:

No distro signature for kernel at /some/path

make this change to recognize Scientific Linux, near line 820 in action_import.py:

    signatures = [
       [ 'pool'        , "debian" ],
       [ 'SL/RPMS'     , "redhat" ],
       [ 'RedHat/RPMS' , "redhat" ],

ISO image generation

We want to use the native "standalone" ISO image generation, but we don't want to actually put the distro files into the ISO. There are two changes to effect this. Near line 285 in action_buildiso.py, simply comment out the lines that copy the distro RPM files into the ISO image:

        print _("- skipping copying distro files to ISO image")
#        cmd = "rsync -rlptgu --exclude=boot.cat --exclude=TRANS.TBL --exclude=isolinux/ %s/ %s/../" % (filesource, isolinuxdir)
#        print _("- copying distro %s files (%s)" % (distname,cmd))
#        rc = sub_process.call(cmd, shell=True, close_fds=True)
#        if rc:
#            raise CX(_("rsync of files failed"))

Near line 320 in action_buildiso.py, comment out the lines that force the install source to be the CD:

            print _("- Not changing install source to CD")
#            cdregex = re.compile("url .*\n", re.IGNORECASE)
#            kickstart_data = cdregex.sub("cdrom\n", kickstart_data)

Setting up Cobbler

Have cobbler 1.6.2-1 installed on system with the above alterations.

Want to import Scientific Linux 4.7 distro, which is already on the machine at /opt/distro/sl/47/ and available at http://hep1.pa.msu.edu/sl/47/

[root@hep1 /]# cobbler distro add --arch="x86_64" --breed="redhat" --comment="Scientific Linux 4.7 x86_64" \
--initrd="/opt/distro/sl/47/x86_64/images/SL/pxeboot/initrd.img" --kernel="/opt/distro/sl/47/x86_64/images/SL/pxeboot/vmlinuz" \
--ksmeta="tree=http://hep1.pa.msu.edu/sl/47/x86_64/" --name="SL47-x86_64" --os-version="rhel4"

[root@hep1 /]# cobbler report --name=SL47-x86_64
distro               : SL47-x86_64
architecture         : x86_64
breed                : redhat
created              : Sun Apr  5 16:52:42 2009
comment              : Scientific Linux 4.7 x86_64
initrd               : /opt/distro/sl/47/x86_64/images/SL/pxeboot/initrd.img
kernel               : /opt/distro/sl/47/x86_64/images/SL/pxeboot/vmlinuz
kernel options       : {}
ks metadata          : {u'tree': u'http://hep1.pa.msu.edu/sl/47/x86_64/'}
tree build time      : Wed Dec 31 19:00:00 1969
modified             : Sun Apr  5 16:52:42 2009
mgmt classes         : []
os version           : rhel4
owners               : [u'admin']
post kernel options  : {}
redhat mgmt key      : <<inherit>>
redhat mgmt server   : <<inherit>>
template files       : {}

Add a base profile:

[root@hep1 /]# touch /var/lib/cobbler/kickstarts/local/SL47.ks

[root@hep1 /]# cobbler profile add --comment="Base Profile for SL47-x86_64" --distro="SL47-x86_64" \
--enable-menu="no" --kickstart="/var/lib/cobbler/kickstarts/local/SL47.ks" --name="SL47-x86_64"

[root@hep1 /]# cobbler profile add --comment="Rescue Mode of Installer" --distro=SL47-x86_64 \
--kickstart=/var/lib/cobbler/kickstarts/pxerescue.ks --kopts="rescue" --dhcp-tag=default \
--name=rescue-SL47-x86_64

[root@hep1 /]# cobbler profile add --comment="HEP Desktop Profile for SL47-x86_64" \
--distro="SL47-x86_64" --enable-menu="yes" \
--kickstart="/var/lib/cobbler/kickstarts/local/HEP-Desktop.ks" --name="HEP-Desktop-SL47-x86_64"

[root@hep1 /]# cobbler system add --name=hx12 --hostname=hx12.pa.msu.edu \
--profile=HEP-Desktop-SL47-x86_64 --kickstart=/var/lib/cobbler/kickstarts/local/hx12.ks \
--comment="Dell Precision"

[root@hep1 /]# cobbler system edit --name=hx12 --ip=35.9.71.94
[root@hep1 /]# cobbler system edit --name=hx12 --ksmeta="ip_address=35.9.71.94"

[root@hep1 /]# cobbler buildiso --iso=/tmp/SL47-x86_64.iso --tempdir=/tmp --distro=SL47-x86_64 \
--standalone --source="/opt/distro/sl/47/x86_64/"

- using/creating tempdir: /tmp/buildiso
- building tree for isolinux
- copying miscellaneous files
- copying kernels and initrds - for standalone distro
- skipping copying distro files to ISO image
- generating a isolinux.cfg
- Not changing install source to CD
- done writing config
- running: mkisofs -quiet -o /tmp/SL47-x86_64.iso -r -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V Cobbler\ Install -R -J -T /tmp/buildiso
Unknown file type (unallocated) /tmp/buildiso/.. - ignoring and continuing.
ISO build complete
You may wish to delete: /tmp/buildiso
The output file is: /tmp/SL47-x86_64.iso

[root@hep1 /]# rm -rf /tmp/buildiso/
[root@hep1 /]# ls -l /tmp/SL47-x86_64.iso 
-rw-r--r--  1 root root 7327744 Apr  5 17:30 /tmp/SL47-x86_64.iso

Kickstart Template

-- TomRockwell - 04 Apr 2009
Topic revision: r10 - 16 Oct 2009, TomRockwell
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback