Discovered host does not get its PXE file created when hostgroup is selected manually.
PXE file should appear in associated subnet TFTP root.
Foreman and Proxy versions:
Foreman and Proxy plugin versions:
Other relevant data:
PXE file gets properly created when using auto-provisioning.
But, in this case, I use provision -> (select hostgroup manually) -> Create host
The created host has a proper location set, can render templates on ‘provision’ tab.
Templates are associated to OS which belongs to selected Hostgroup.
Subnet has TFTP proxy assigned.
No POST request arriving to TFTP proxy in this scenario, hence I don’t even have logs to attach.
Nothing relevant in Foreman logs.
Now the interesting stuff:
The hostgroup has no subnet (I want to avoid setting up hostgroups per subnet).
Discovery detects the subnet correctly. In ‘discovered hosts’, the host has a correct subnet.
Auto-provision passes this detected subnet from discovered host to the ‘main’ host object correctly.
Non-auto provision does not do that, the host object gets created with empty subnet field.
Once added subnet to the hostgroup, the PXE file gets created in both (auto and non-auto) scenarios.
Subnet defines where TFTP orchestration should happen, without Subnet Foreman will not orchestrate TFTP (or DHCP) at all. You need to set it, otherwise it won’t create TFTP files.
Thank you for you reply.
In this scenario, hostgroup has no subnet. Yet, the subnet is provided by discovery.
Using auto-provision on discovered host: resulting host object has subnet ‘pulled’ from discovery (great).
Using provision -> create: resulting host object ignores discovery subnet (not so great).
Hostgroup construction does not force a subnet. This allows a more flexible model, where you don’t need a hostgroup per subnet.
Maybe it would be possible to have some ‘subnet priority’ (discovery vs hostgroup) or just pull subnet from discovery whenever hostgroup does not provide.
So you are not using Customize Host button but Create button directly?
These are the lines which are responsible for setting up hostgroup params:
You want to experiment with this, probably doing some
if host.hostgroup.subnet.nil? && host.subnet.present? then set it or whatever you like. Then file a RedMine issue and patch if you are interested.
It’s all about this inconsistency of ‘auto-provision’ vs ‘provision -> create’.
I believe it’s fair to call it a bug. The same hostgroup applied in mentioned ways produces different host.
Thanks for pointing the relevant file. I will try something like this in line 11:
if host.hostgroup.subnet.nil? || !host.subnet.present?
host.subnet = original_host.subnet
I know ~nothing about Ruby but it’s worth a try.