Edit dhcpd.leases through a foreman-hook script

HOOOLY **** ! This was exactly the kind of solution I was looking for!
Here’s what I did:

  • Edit /usr/share/foreman/app/models/concerns/pxe_loader_support.rb, added the ESXi efi bootloader to the function all_loaders_map

def all_loaders_map(precision = ‘x64’)
{
“None” => “”,
“PXELinux BIOS” => “pxelinux.0”,
“PXELinux UEFI” => “pxelinux.efi”,
“ESXi UEFI” => “mboot.efi”,

}

and restarted httpd.

  • Through the web UI, change the PXE Loader of the host to ESXi UEFI and set build mode on.
  • Create a before-provision foreman-hook script that changes the host’s PXE Loader to None (of course after a bunch of checks).

Now you have a fully working ESXi UEFI installation workflow through Foreman.

I have no words to thank you Lukas! I have been looking for a solution to this for a long time! You have saved me from a lot of manual work!

I will submit a PR for this. Also we would need this in hammer-cli as well and update the apidoc. I have tested using api v2 and it works too.

2 Likes