Keep DHCP configuration for iPXE

Problem:

So following some issues I ran into with UEFI hosts, I decided to follow some advice lzap posted on the forum some time back on ditching TFTP and configuring iPXE.

I did that using section 5.3 of the Provisioning guide https://docs.theforeman.org/master/Provisioning_Guide/index-foreman.html#_chainbooting_foremanserver_to_use_ipxe_directly

But I noticed that it requires manually adding some config to /etc/dhcp/dhcpd.conf to enable iPXE.

However, every time foreman-installer runs, it will restore the dhcpd.conf to it’s known last default config.

Is there any way to make changes like that stick? Can I use a flag in foreman-installer to put it there? Or can I stick it in some other file/somewhere in hiera?

Expected outcome: foreman-installer not automagically removing my config for iPXE.

Foreman and Proxy versions:
Foreman 2.1
Katello 3.16

Distribution and version: CentOS7

I think you can pass --foreman-proxy-dhcp-managed false to the installer, to keep it from overriding your changes.

I see, well, the thing is, I was looking for a idempotent solution that would still manage all the other aspects for DHCP (so I could incorporate it in my role).

So I noticed that the default config includes ‘/etc/dhcp/dhcpd.hosts’. It’s a bit hacky, but I stuck it in there :slight_smile:

Well scratch that, it seems dhcpd.hosts is also overwritten :frowning:

I’ll just set the config as the last thing in the role then, that’ll make sure it’s there each time the role completes it’s run (as it will enable that flag each time to make sure the Foreman server is prepared for deployment)

Until I find a better solution :slight_smile:

Maybe @ekohl has a clever idea?

Add an include via custom-hiera.yaml?

dhcp::includes: "/path/to/config"

Can also be an array of multiple files.

A long term solution would be to add it to puppet-foreman_proxy, similar to how we added support HTTPBoot:

2 Likes

That works! :slight_smile: thanks a lot!