THE GAME HAS CHANGED

Introducing Infoblox Universal DDI ManagementTM

Watch the launch to discover the new era of management for critical network services. Watch Now

API & Integration, DevOps,NetOps,SecOps

Reply

search for a host in a specific network

New Member
Posts: 3
5683     0

We have subnets tagged with extensible attributes that we can use, but as a validation I'm trying to lookup a hostname in a specific network and not everything. Is this possible?

 

we use ansible and as an example we have this to lookup a network and then add a record to it

target_network"{{ lookup('infoblox.nios_modules.nios_lookup', 'network', filter={'*Site': 'UK-north','*Platform': 'Dev', '*Type': 'test_network'}, return_fields=['network', 'extattrs'], provider=nios_provider) }}"

How can I use that network in a hostname search?

Re: search for a host in a specific network

[ Edited ]
Superuser
Posts: 81
5683     0

Hello, 

 

Can you define what "host" is in your terms ? It can be a DNS RR with DHCP enabled/disabled, DHCP lease within a network, Fixed address etc. If there's a call which yields what you need + the extras, that'll be helpfull. If not, can you please define a "Host" to be sure ?

 

Best regards,

 

Re: search for a host in a specific network

New Member
Posts: 3
5683     0

Hi,

 

Just a fixed IPv4 address . 

So i want to be able to get any records using something like below

set_fact:
  records: "{{(lookup('infoblox.nios_modules.nios_lookup', 'record:host', filter={'name': 'test.domain.com'}, provider=nios_provider)) }}"

but only return entries in a certain network which i've grabbed using this..

set_fact:
  deploy_target_network: "{{ lookup('infoblox.nios_modules.nios_lookup', 'network', filter={'*Site': 'test_site', '*Type': 'test_network'}, return_fields=['network', 'extattrs'], provider=nios_provider) }}"

Re: search for a host in a specific network

Adviser
Posts: 181
5683     0

Hi,

 

You should be able to specify the network field on to the host as a filter. Please note that this will only work for WAPI versions 2.11 onwards.

 

set_fact:
  records: "{{(lookup('infoblox.nios_modules.nios_lookup', 'record:host', filter={'network': '10.0.0.0/24'}, provider=nios_provider)) }}"

If you are looking for all IP addresses that are being used in a subnet, you can use the following lookup:

set_fact:
  records: "{{(lookup('infoblox.nios_modules.nios_lookup', 'ipv4address', filter={'network': '10.10.10.0/24','status':'USED'}, provider=nios_provider)) }}"

Hope this helps,

Regards,

Krishna Vasudevan

Re: search for a host in a specific network

New Member
Posts: 3
5683     0

Thanks Krishna,

i got something going with

when"(lookup('infoblox.nios_modules.nios_lookup', 'ipv4address', filter={'network': target_network.network ,'status':'USED', 'names': 'test.domain.com'}, provider=nios_provider)) | length == 0"

I have a stage problem though.

When I try to add a record with '
nios_next_ip' on the network I'm interested in, then it moves a record from another network also. 

i.e. 

network 10.0.10.0/24 has test.domain.com with reservation 10.0.10.1

when I try reserve something else like 
test.domain.com on 10.0.20.0/24 with nios_next_ip . it moves the record from 10.0.10.1 to 10.0.20.1 and then the new record to 10.0.20.2.
So I end up with: -

test.domain.com 10.0.20.1
test.domain.com 10.0.20.2

I then found the param in the module "addtrue" but this fails if no host record exists already.

Re: search for a host in a specific network

Posts: 10
5683     0

Hi 

 

I'm trying to get all the records of any particular network. Can you advise how can I retrieve it? Where can I get the ns_lookup module? Can I still get something similar using wapi version 2.7please?

I don't see 'network' field in the record object in the documentation 

Any help would be greatly appreciated.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You