External DHCP, Foreman PXE-less, Discovery Image Setup help

Problem:
[Background]

In an office network already managed by DHCP (hands out addresses on 10.10.0.0/16). Not permitted to run DHCP on Foreman so the work around is configure Discovery Image.

There’s a external iPXE server (10.10.1.217) already configured that successfully installs the Discovery Image to network booted clients.

Foreman/Foreman_Proxy are running on 10.10.16.32. (https://foreman.network.com). Also the unattended provisioning URL.

Created a Subnet on Foreman (10.10.16.0/24). Specified None for IPAM and Boot Mode is set to static. Didn’t specify DNS server/gateway.

From the Discovery Image, using DHCP configuration works and updates the discovered hosts in Foreman (Status: SUCCESS -awaiting kexec into installer). All hosts get placed in the default organization and location.

When trying to provision host from Foreman Web- Attempting to install CentOS 7 with Discovery Template (kickstart default) and Provisioning Template (Discovery Red Hat kexec).
Host interface ->
DNS Name : mac005056b5d057
Domain: foreman.net
IPv4 Subnet: Discovery(10.10.16.0/24)
IPv4 Address 10.10.16.159

Output during provisioning on the Discovery image is: Warning: anaconda: failed to fetch kickstart from https://foreman.network.com/unattended/provision?token= [token number] &static=yes ). Tried extending token expiration.

Expected outcome:

Join Discovered host to the subnet and find/use the kickstart provisioning file.

Foreman and Proxy versions:
2.5.0

Foreman and Proxy plugin versions:
foreman_discovery 17.0.1

Distribution and version:
Ubuntu 20.04.2 LTS Focal Focus

Other relevant data:

When you don’t specify and DNS info, how clients are supposed to resolve this:

?

Let anaconda to timeout and then in the shell, check network configuration. Specifically DNS.

1 Like

Thanks for the reply. @lzap

& yes I understand that without setting the DNS server in the subnet configuration that the host will not resolve.

Since DHCP/DNS are both external - after the host is discovered, I configure the primary interface to not be Managed (uncheck “Managed”. The description provided for this option is; “If the Managed flag is disabled, none of the services will be configured for this interface, even if it is configured for the subnet and domain”).

Nevertheless, I had also tried setting the DNS server in the subnet to the authoritative DNS server on the network. The result was the same - “failed to fetch…”

To fix the problem that I was having:

  • I configured the unattended/provision URL to [HTTP] in :

[Administer>Settings>General] & [Administer>Settings>Provisioning].

  • Additionally I uncommented/added

:http_port: 80 in [/etc/foreman-proxy/settings.yml]

  • Then restarted the foreman service.

Attempt #1:
Provision on the Discovered Host. Managed flag enabled on the primary interface and pointing to the external DNS server in our configured subnet.

Got this error:

“There was an error rendering the Kickstart default template: ERF42-7327 [Foreman::Exception]: The snippet ‘puppet.conf’ threw an error: undefined method ‘#present?’ for Safemode::Jail (Environment)”

After looking around online for a while, I found (Fixes #32772 - allow present? on ApplicationRecord by ezr-ondrej · Pull Request #8581 · theforeman/foreman · GitHub)

  • Applied the patch locally and reset the foreman service.

Attempt #2:
Success! Kickstart file was found and loaded during provisioning. Discovered Host installs centOS 7.2 with no errors.

1 Like