- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
search for a host in a specific network
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2021 06:24 AM
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
How can I use that network in a hostname search?
Solved! Go to Solution.
Re: search for a host in a specific network
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2021 04:10 PM - edited 06-27-2023 01:28 PM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2021 02:19 AM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2021 01:29 PM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2021 04:44 AM
Thanks Krishna,
i got something going with
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 "add: true" but this fails if no host record exists already.
Re: search for a host in a specific network
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 10:34 AM
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.