PXE Lessons learned

When provisioning goes wrong, it can eat up a lot of time. I need to install and configure a RHEL 8 machine to act as an HA proxy for an OpenShift install, and it was somewhat resistant to my efforts. I learned a couple things worth recording:

  1. The minimum size of a VM for a PXE install is roughtly 3 GB now, as that is what it takes to properly handle the initrd. If you make the VM too small, the Filesystem in the initrd gets corrupted.
  2. If the kickstart fails, you can change “graphical” or “cmdline” to text and get an interactive install, which should set you up with a properly formatted kickstart config in the VM /root/anaconda-ks.conf file when you are done.
  3. You are going to want to keep an index file based on the MAC addresses of the Hardware you are provisioning. Right now, I am using the symlinks in the tftp directory to play that role. The script I use to set the symlinks is below.
  4. I really should be using Cobbler to manage all this. I’ll learn it some day.
#!/bin/sh
 
function reset_link(){
 
MACHINE=$1
TARGET=$2
echo  ---------------------------------------
echo reset          $MACHINE
rm             $MACHINE
ln -s $TARGET  $MACHINE
}
 
r610s='01-00-21-9b-93-d0-90 01-00-21-9b-98-a3-1f 01-00-21-9b-9b-c4-21'
 
kvms='01-52-54-00-2d-74-f1 01-52-54-00-dc-37-cb 01-52-54-00-52-fa-3d'
 
LB=01-52-54-00-b1-5b-16
BOOTSTRAP=01-52-54-00-29-0b-bf
 
for MACHINE in $r610s
do
reset_link $MACHINE rhel8.2-r610
done
 
for MACHINE in $kvms
do
reset_link $MACHINE rhcoreos-4.4.3-kvm-control
done
 
reset_link $BOOTSTRAP rhcoreos-4.4.3-kvm-bootstrap
reset_link $LB rhel8.2-kvm

This is obviously ripe for a YAML type config file.

To convert a MAC to the appropriate form for pxelinux.cfg use this bash. note that I prepended 01: to the mac address so that it is ends up in the right place in the final file name:

echo  01:52:54:00:e0:f0:fd | sed 's!:!-!g


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.