Ability to leave IP address field empty when creating new host
Description of problem:
In some environments, Foreman is used to provision new hosts, but DHCP is not running on Foreman/Smart Proxy, but already exist (e.g. from AD) and is not known to the Foreman.
In this situation, when creating a new host, it is not known what IP the host will get from the DHCP, but you still have to provide an IP (which will be set in the Foreman but ignored by the DHCP) in the Interfaces tab under Hosts -> New Host.
This makes no sense and creates confusion for customers, since that IP is not used anyway.
Version-Release number of selected component (if applicable): 6.2.12
Steps to Reproduce:
1. Setup a Foreman and Smart Proxy (or use the internal Smart Proxy on the Foreman) in a subnet where DNS and DHCP is provided by another party (e.g. AD).
2. Start the TFTP service on the Smart Proxy
3. Make sure the existing DHCP has configured the Smart Proxy as next-server
4. Create a subnet declaration for the subnet in the Foreman. Since you don't have DHCP running on the Smart Proxy the only sensible choice (to me) is to set "IPAM: None"
5. Under Smart Proxys, choose the Smart Proxy as TFTP Smart Proxy and leave the others to None, since neither of the other features are enabled on the Smart Proxy.
6. Now create a new host (Hosts -> New Hosts). When you choose the subnet in the Interfaces tab, you have to manually input an IP (which you don't know at this stage). Otherwise you can't create the host. You can input whatever IP you want that is in the range of the subnet, it does not matter.
7. Press Submit and the host is created and built with an IP assigned by the DHCP.
You have to input a random IP since you don't know what IP the DHCP will provide, in order to be able to create the host.
Alternative 1: If you choose "IPAM: None" in your subnet declaration, you should be able to leave the IP field empty.
Alternative 2: Add another option to the IPAM field that allows you to create a host without providing an IP address.
I have seen this with multiple customers that have an existing network they want to use where they have these components in place. I know that the Smart Proxy can integrate with different providers, but IIRC AD DHCP is not one of them (yet).
One workaround is to set "IPAM: Internal DB" and set start and end of IP range to e.g. the first IP in the DHCP range. Then the Foreman will suggest the same IP every time even if it is not the one the host will get in the end.
It is also possible to make sure that the Foreman updates to the correct IP after build is complete with the following setting: Administer -> Settings -> Provisioning -> Update IP from built request.
#2 Updated by Aditi Puntambekar over 4 years ago
I think even when DHCP is running on the foreman/smart proxy and IPAM is set to None, IP address field is mandatory but, the IP address assigned to the provisioned host is different than the one provided by user ( i.e. assigned by dhcp service running on the foreman proxy). Only, when dhcp is not running on foreman proxy, IP address is not mandatory. Is that right? Any inputs?
#3 Updated by Daniel Lobato Garcia over 4 years ago
I think you are right. Also notice the use case where an user may want to create a new host on a remote compute resource (for example EC2). There is no reason the user should put anything in the IP field as the IP will be created and assigned by EC2 automatically on creation.