We're in the process of migrating our hardware provisioning from Cobbler to
Foreman, and I've run into an issue with DHCP configuration. We're running
a Cobbler server in each of our datacenters, of which there are many, for
hardware provisioning.
On our Cobbler servers, we run DHCP with host reservations, while
disallowing unknown hosts. We do this via Cobbler's DHCP Management
feature: http://cobbler.github.io/manuals/2.6.0/3/4/1_-_Managing_DHCP.html,
and a dhcpd.conf template. Since our Cobbler server lives on the same host
as the DHCP server, it's able to rebuild dhcp.conf from a template, and
create hardware reservations for each system stored locally on disk.
We're replacing this configuration with one that uses Foreman + local
Foreman smart proxies in each datacenter, and I need a way to dynamically
create these host reservations.
I looked at the DHCP puppet module:
https://github.com/puppetlabs/puppetlabs-dhcp, but using it seems to
require that I have host information stored within puppet. Host
reservations are created like so:
dhcp::host {
'server1':
mac => '00:50:56:00:00:01',
ip => '10.0.1.51',
}
…I want to avoid storing the host data in two places (in Foreman records,
and within a Puppet module). I'd like to have the DHCP host reservation
created directly from the Foreman host record.
Since the Proxy doesn't seem to be able to manage the dhcpd.conf file, it
seems like the only way to accomplish this is via OMAPI (which
unfortunately is transient and doesn't manage the dhcpd.conf file), or a
locally hosted, custom script on the Smart Proxy which manages dhcpd.conf.
My thought is to have a foreman hook on the Foreman server that calls this
custom "DHCP Manage" script on the local Smart Proxy whenever "Build" is
clicked on a host, to ensure its hardware reservation exists.
Does that sound reasonable, or is there a better way to do this? (Side
note: I was going to use a small pool of DHCP addresses (5-10) in each
segment, and dedicate them to new builds, rather than use host
reservations, but there are many segments, and some of them don't have free
IP space… hence, I chose to stick with the host reservations)