TFTP Boot 'default' File Assistance in Regard to Multiple OS Versions

Problem:
Used Foreman’s Build PXE Default to create tftpboot ‘default’ file
Forced to modify ‘default’ file with hard-coded reference to a specific OS version.
Multiple OS version images are uploaded to the boot directory.

default file:
DEFAULT linux
LABEL linux
KERNEL boot/OracleLinux-8.3-x86_64-vmlinuz
APPEND initrd=boot/OracleLinux-8.3-x86_64-initrd.img ks=http://mypuppetserver.luminexcorp.com:80/unattended/provision network ks.sendmac
IPAPPEND 2

Issue: I need to be able to choose different OS vmlinuz versions. I attempted several unsuccessful variations within the default file to accept variables fed from foreman pxelinux templates to which I specify different OS versions to boot from.

Expected outcome:
Need capability to kickstart/boot from multiple OS versions from within tftpboot directory.

Foreman and Proxy versions:
Latest
Foreman and Proxy plugin versions:
Latest
Distribution and version:
3.0
Other relevant data:

Updated Attempted Changes:
From Foreman’s Kickstart default PXELinux template:
DEFAULT menu
MENU TITLE Booting into OS installer (ESC to stop)
TIMEOUT <%= timeout %>
ONTIMEOUT oraclelinux83

LABEL oraclelinux83
MENU LABEL <%= template_name %>
KERNEL <%= @kernel %>
APPEND initrd=<%= @initrd %> <%= pxe_kernel_options %> <%= snippet(“OL83_kickstart_kernel_options”).strip %>
IPAPPEND 2

I like-wise cloned this same template from OL83 to OL76 and reflected the changes accordingly within.

I updated /var/lib/tftpboot/pxelinux.cfg/default to the following to include both 83 and 76 labels above:
DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200

LABEL oraclelinux83
MENU LABEL OL76 Kickstart default PXELinux
KERNEL boot/OracleLinux-8.3-x86_64-vmlinuz
APPEND initrd=boot/OracleLinux-8.3-x86_64-initrd.img ks=http://puppet.luminexcorp.com:80/unattended/provision network ks.sendmac

LABEL oraclelinux76
MENU LABEL OL76 Kickstart default PXELinux
KERNEL boot/OracleLinux-7.6-x86_64-vmlinuz
APPEND initrd=boot/OracleLinux-7.6-x86_64-initrd.img ks=http://puppet.luminexcorp.com:80/unattended/provision network ks.sendmac

It will successfully install/boot the OL83 OS but will not allow OL76 to be booted and instead defaults into OL83.

Somehow, I am missing how the template passes or uses the ‘LABEL’ within the default file to boot via PXELINUX

This is not how Foreman works. See, Foreman always assumes you are installing a single OS and it will only prepare PXE files for that particular OS. Template is rendered with variables set in a way that you are installing that OS, meaning PXE kernel and initramdisk is set to a single path. This wont work.

However, Foreman has a (quite hidden) feature that allows you to do exactly what you need - this is called a hostgroup provisioning. You create multiple hostgroups like Debian 10, CentOS 8 Stream and AlmaLinux 8.5 and then after association of hostgroup combinations, you can actually start servers and register them into Foreman even without creating them in Foreman in advance. That is the good news for you.

The bad news is this is not documented, I would love to remove this feature at some point and replace with with more simple approach - just a single template (PXE, provision), a button that would download all PXE files and registration via our host registration snippet instead of Puppet. Similar question last year:

Here is a video that describes, it is longer because it also shows how to synchronize content via Katello, if you do not use Katello you can just skip this and simply use an installation media:

Thank you for the response. To confirm, for my understanding…
I have an older puppet/foreman v1.10 currently working and able to boot/install multiple versions of OS’s. From Centos ISO images, Redhat, to Oracle Linux, I am able to create new servers by selecting the OS of choice from the Foreman create host provisioning menu.
The latest Foreman 3.0 I have installed, I have made use of the ‘host group’ provisioning option and associated the media directory paths, environment, etc… and am still forced to use the first hard-coded option within the default file as noted above.
I will review the video and see if there is something within that I may have missed. We don’t use Katelo.
If I set the default file to a generic entry as follows, when booting the newly created server, it says it cannot find the local OS image. I have verified the tftp and dhcp next_server variable are set correctly.
DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local

LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT 0

This same default file is used on the older puppet/foreman 1.10 server successfully. I have taken extensive time cross-comparing the older server configuration with the new puppet/foreman configuration and as of yet am unable to determine why 1.10 works and 3.0 doesn’t.

Shawn

Screenshot please.





Screens posted with the default file set as noted in the right frame with a generic default menu that is currently working on our existing older puppet/foreman 1.10 version.

However, if I set the pxe default file to specifically state the boot file image location as posted previously, foreman successfully finds the image and starts the install for OL8.3.

I verified the dhcpd.conf has the correct next_server parameter and also the tftp.yml has correct parameters.
I verified xinetd has a tftp config file and is set correctly.

Shawn

I can comment on that PXELinux error. It means that it tried to boot from the 2nd device (typically you set BIOS with this order: network, hdd). And it did not contain an operating system.

I am not sure what exactly is your workflow so not sure what is going on.