Automated provisioning (#2) - The Foreman, part 2 - Defining and creating a subnet, DHCP proxy

In this post I'll be creating a subnet and attempting to setup a DHCP server / "DHCP Proxy" for Foreman to use. It'll exist on the same server as the Foreman host.

In Foreman, I navigated to Infrastructure -> Subnets, then clicked Create Subnet.

Creating our homeprod subnet.

I chose network options that matched my subnet settings, then an IP range from 10.1.200.1 through to 10.1.203.254. I set Boot Mode to Static so that Foreman-deployed machines will boot using DHCP for their first boot and installation, then configure themselves with static addresses later. As Foreman does not yet integrate with ISC Kea, my chosen DHCP server, I can't automatically create static DHCP leases for deployed machines, so permanent DHCP on deployed machines would lead to some confusion. I have some ideas on how to "solve" this, but they'll have to wait.

Selecting windowpa.in as a domain.
The created subnet, ready for use... or is it?

Now that a subnet is created... we can't actually do much with Foreman just yet. We need a DHCP proxy to allow us to PXE boot machines. We also need to modify our primary DHCP server to delay its offers slightly, to allow time for Foreman to jump in with its own DHCP offer for machines it is deploying.

40ms is probably too much, but should be imperceptible to users of the network.

Next, we (re)configure Foreman (hints were taken from this thread).

wings@foreman01:~$ sudo foreman-installer \
--enable-foreman-proxy \
--foreman-proxy-tftp=true \
--foreman-proxy-tftp-servername=10.1.1.10 \
--foreman-proxy-dhcp=true \
--foreman-proxy-dhcp-interface=ens18 \
--foreman-proxy-dhcp-gateway=10.1.1.1 \
--foreman-proxy-dhcp-nameservers="10.1.2.1,10.1.2.2"
Foreman uses Puppet internally as an installer, so this is "idempotent".

And in Foreman, open the configuration for the subnet we created before (Infrastructure -> Subnets) and select our newly-created proxies.

Setting "DHCP Proxy" and "TFTP Proxy" to our new DHCP server.

Save it, and we're done!

Theoretically we're ready to deploy machines with Foreman as soon as we define some operating systems.