I’m deploying Ubuntu 20.04LTS to bare metal hosts, I’m booting them using a customized FDI image that has DHCP enabled and the Foreman server target baked in. I have an external DHCP server that is not managed by foreman, when I Auto provision the hosts the IP address is statically set to the IP address that was assigned during discovery. The interface is marked as managed, and once the host completes provisioning the interface is set to manual rather than automatic/DHCP.
I’m using foreman v2.2.2 with the 3.5.7 discovery image.
I believe I just need the managed flag to be unchecked when a new host is provisioned but I’m not entirely sure how this is set. I’ve tried configuring the subnet and domain proxy’s to not have dns, and default gateways, but this just results in the Debian installer not being able to resolve hostnames after Kexec. I’ve also tried setting IPAM to DHCP but the new host always has an IPv4 Address assigned. If I remove subnet and domain from the Host group then the host will fail to auto provision.
managed flag in interface means that Foreman tries to configure such NIC during provisioning.
Managed DHCP means a subnet in Foreman has DHCP Smart Proxy set, therefore it performs DHCP management when host is created/updated/deleted. If you want to have a host in unmanaged DHCP network, then simply unassociate DHCP Smart Proxy for that subnet (leave it blank) and no DHCP operation will be performed.
Another option is to set IPAM of your subnet to Manual, this will mean that IP address must be always entered when creating new host. In case of discovered hosts (I haven’t tested), this should keep the IP that the host was discovered with.
I had actually tried that combination of settings before and the provisioning template appeared to render correctly, however when provisioning the hosts would still have a static IP assigned.
After some investigation I believe I have found the issue. It would appear that in the kexec_debian.erb (and most likely redhat) template provided by the discovery proxy plugin forces the provisioning template to be rendered as static.