3 weeks ago
Is there a single API call to see if a server/host/dns name is in use?
Essentially, when needing to provision a new server, I want to do a DNS check (of sorts) to see if a host with that name already exists, but I noticed that host-record, host-alias, cname (and possibly others) etc. are all seperate calls and objects.
For instance, I could have a host-alias called "myserver.mydomain.org", but if I were to do a host check against this server, it would return nothing. Similarly I could have a cname called "myserver.mydomain.org" and do a host and/or alias check, and still get nothing back because cnames are yet again different.
I'm hoping there is a single API call I can make that would return a match irregardless of the type, but so far I haven't been able to find it or overlooked it.
3 weeks ago
I'm not aware of anytthign that will do exactly what you want but this seems to work pretty well. It requires the FQDN to be split into the zone and the hostname.
It will return a list of matching records. I found that for host aliases, and for DTC LBDNs it says the record type is "UNSUPPORTED". Otherwise it will also return the record type. An empty response would indicate the record does not exist.
curl -k -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v2.11/allrecords' -d 'name=myhostname&zone=example.org&view=Internal%20DNS&_max_results=2'