Get Ip from hostname

Hello,

For automatic host grouping I will use cidr_match function to set a vars.zone automaticly
The goal is to not have to change the config file when we change an host from a “zone” for this address var use fqdn.
cidr_match need ip address so is their a way to get ip of a host or from fqdn without setting it manualy ?

Hi,

no, the DSL does not provide external query providers by design. The same question applies to system(), dbquery(), etc. While technically possible, this will result in non-reproducible environments and was denied as feature request.

Therefore I’d suggest to generate the host objects and their IP addresses with a script, a config management tool, inventory interface and similar. Or you are already using the Director which may provide this in its import sync rules/property modifiers.

Cheers,
Michael

Hi Michael,

Thanks for your complete answer despite that it will be not good for me :smiley:

I will put the zone directly in the host configuration. Thanks again

1 Like