I am dabbling with using Ansible as part of our server creation process and a component of that is interacting with Infoblox. Our network team has configured all of our server subnets to be DHCP so whenever we deploy a server, we leave the network adapter as DHCP and then create a host record with MAC address on a particular IP we want to use. The problem that I am having, is that when trying to use nios_next_ip in Ansible, it does not see any free IPs since they are technically used as part of the DHCP scope. Is there a way around this or some way to use the Ansible module to check if a host record exists on an IP? There are many many subnets so I do not want to have to go to the network team and request another one that does not have DHCP enabled (if at all possible).
2 weeks ago
If you are already using DHCP, the best practice would be to allow the DHCP server to handle the DNS record for you. As long as DDNS is enabled (in the DHCP properties), the DHCP server will create the corresponding DNS record on behalf of the client when handing out a lease and conversely, the DHCP server will remove the record when the client releases the IP or the lease expires. NIOS includes (by default) built-in protection with the TXT record handling feature so that these records will not be overwritten by other clients and you can also 'lock' these records to further protect them.
The only other option would be to 'shrink' the DHCP range to make additional IP's available. A common practice is to put a reservation on the gateway address and then leave 5-10 IP's free before the start of the DHCP range.
Thanks for the response. The process we use is to manually create a host record and enter the MAC address and just leave the end server as DHCP. This allows us to 'statically' set an IP without doing it on the server itself. I'd imagine the easiest way would be to request networking to shrink the DHCP scope and allow a number of free IPs to allow for the automation process to be able to assign IPs. Thanks