Default pxe menu option to provision OS

In my “old” environment, I have a TFTP server that offers a menu of available OS’s. To provision a linux host, they just pick from a menu. Each entry in pxe includes flags about what was picked (server vs workstation, which disk to install on, etc). It installs and runs puppet. The admins don’t have to setup the host ahead of time.

I’m hoping there’s a way of doing something similar in Foreman. I want the onboard process to be as easy as possible. Give them a list of options. Then the machine installs and gets setup in foreman using defaults (ideally based on what they picked).

I found a 10 year old post talking about host templates, but the linked wiki page doesn’t really explain how it’s used ( And I imagine the host still has to be in a hostgroup for that to work.

Is there any way to do what I want to do?

Hey @clevelas

Have you seen our Provisioning Guide

I have at various times. It’s a huge document. Is there a particular part that addresses my question?

My assumption is that you’re talking about discovery? That is something I’m looking at, but still requires multiple steps. Maybe I need to dig more into the discovery rules?

The best way to achieve that is to define a “combination” for a provisioning template in it’s edit form, see the association tab. Then you must deploy the default pxe template to your TFTP server. On provisioning templates tab, hit the Build PXE default button. It will generate entry for each hostgroup for which tou created the combination. The hostgroup must define all attributes required for provisioning. You can create hostgroups matching the OSes you want to allow for provisioning through the PXE menu.

1 Like

I’m trying to parse this Marek. I would create a new pxe template that just has the boot options I want (so I manually have to set CentOS 8 Steam or whatever). Then use the Association tab to assign an OS and associate it with a hostgroup?

I’m not quite understanding what that does? Can it use that OS association to build the menu using some variables in the template?

What is the combination used for? As far as I can tell, that restricts which hosts can use that template, right? So I’d still have to create the host in Foreman before being able to install it?

Foreman has a lot of concepts that are new to me. I think they’re very powerful, but it’s takes a bit to wrap my mind around things.


it is a bit hidden feature and we have no documentation for it, because it does not work well with our kickstart templates which we ship with Foreman. They all assume there is a @host in the context, while in this “hostgroup provisioning” there is not.

Here is a lengthy video that hopefully describes it. It is a bit out of date, however, still applies. Grab a coffee!

1 Like

That looks like exactly what I want. Thank you for linking to the video. I wasn’t understanding that it needed a custom kickstart template to work.

A couple of questions:

1 - Is the ’ all media’ workaround still needed?
2 - I assume we can include snippets in the custom kickstart file as long as @host isn’t used? He also mentions some other variables that won’t work. Is there a list?
3 - At the end he mentions that once you run puppet it will show up in Foreman as an unmanaged host. Is there any way to address that? I don’t think that will be a big deal for us, just curious.

Time to start playing with it.

1 Like

Another question. Since it doesn’t register the host in Foreman, the host is not in the hostgroup when puppet runs. Therefore it won’t get any parameters from that host group. So I would be losing most of the features of the Puppet ENC. I’d have to do all of the node stuff in puppet directly. Is there any way to work around that? I could go assign it to a hostgroup after the fact, but that kind of defeats the purpose of what I’m hoping to accomplish.

I think you can fix that by adding the ‘rhsm_register’ snippet to your Kickstart template.

That’s also what is used during a ‘regular’ installation :slight_smile:

1 Like
  1. I vaguely remember I do not think you need this. That was some Katello compatibility issue I think.
  2. Exactly, feel free to update Foreman default templates or snippets to work without @host if you want to.
  3. If you install puppet agent (or any other client that creates hosts in foreman via facts) an unmanaged host will be created for you unless you disable that in settings

I am not sure how to solve that honestly, perhaps get a host registered? We now have couple of registration snippets which you could use too (the new host registration feature). If you do that before puppet it should work? I am not sure how to associate hostgroup tho, I think there is some kind of plugin for that too.