Non-pxe provisioning

Problem:
At work we are using Foreman in order to provision servers. But we would like to (somehow) use Foreman to provision / configure a (Dell) switch. What we need to configure a Dell switch is as follows:

  1. Create a template file in the TFTP folder (so not a PXELinux template file but a non-pxe template file) containing the Dell switch configuration
  2. Instead of using the DHCP ‘filename’ option use the DHCP ‘configfile’ option which provides the path to the (rendered) template file.

I expect that (automatically) adding the ‘configfile’ DHCP option when adding a host (actually a switch) to Foreman will be not possible yet? Or is there a way to accomplish this?

But what would be the best approach to let Foreman render my defined template file (non-pxe) in a user-defined folder in the TFTP directory? Which template type do I need so when I add a host, this template will be rendered in a pre-defined TFTP folder?

Expected outcome:
When adding a host to Foreman create a template file what will be rendered when a host is added to Foreman. This template file should be placed in the TFTP folder. If it is possible, DHCP should NOT use the ‘filename’ option but the ‘configfile’ option, referencing the created template file in the TFTP folder.

Foreman and Proxy versions:
Foreman 1.24

Foreman and Proxy plugin versions:

Distribution and version:
Debian 9

Other relevant data:

It would be great if someone can give some hints / solutions for solving this problem!
Thank you in advance!

You can’t achieve this without chaning the code. In short, what I think would be the best approach:

  • Introduce new template kind called “Bootconfig”.
  • Implement new code in TFTP smart proxy code that handles the new kind type and stores it on TFTP into configurable directory (something /configs by default). I’d stick with MAC-address based file name convention: /configs/aa:bb:cc:dd:ee:ff. https://github.com/theforeman/smart-proxy/blob/develop/modules/tftp/server.rb
  • No changes in the TFTP orchestration in Foreman core should be required.
  • Create a new PXE loader option called “Boot config only”.
  • Change DHCP orchestration in a way that when PXE loader is set, then it does not set nextserver DHCP option but the one you needinstead: https://github.com/theforeman/foreman/blob/develop/app/models/concerns/orchestration/dhcp.rb#L133
  • Make a change in our puppet installer so it creates configs subdirectory with appropriate permissions so this works out-of-box.
  • Create a new host, associate it with an OS with Bootconfig template, associate a template with it, give it the Boot config PXE loader and you are good to go.
  • Provide some template examples for the new kind in our https://github.com/theforeman/community-templates

I can review and test the patches if you choose to contribute this. You can also hire external developers to do the job for you if you don’t have Ruby on Rails skillset.