An Ansible Approach to Registering RHEL Systems

I am constantly creating and deleting virtual machines. These virtual machines often are RHEL systems, and need to be registered with Red Hat’s CDN. While In the past I had a Role that was wrapped into other provisioning playbooks to perform this task, I find that there are enough one-offs to make it useful to do this as a stand alone playbook. Here is how I set it up, including my rational.

Continue reading

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


PXE Setup Part the First

PXE is conglomeration of tools used to get a new operating system onto a computer. It is based on two protocols: DHCP and TFPT. I used PXER a long time ago at Penguin and have always wanted to set it up for my home personal use. I’m doing that now for my lab. My goal is to first be able to provision virtual machines, and then to provision physical boxes. I need to do a full install of RHEL 7 and RHEL 8, which means I also need Kickstart to automate the install process. I had it working, but after rebooting the NUC it is running on it broke. Here’s my debugging.

Continue reading