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

Ansible lookup for ipv4addr not returning all entries

New Member
Posts: 2
3950     1

When I try to fetch all IPv4 records in Infoblox using the Ansible collection as below, it returns a subset of all the IPs

- name: Fetch all host DNS records from Infoblox
  set_fact:
    all_infoblox_interfaces: "{{ lookup('nios', 'record:host_ipv4addr', provider=nios_provider) }}"

However when I try to apply a filter on this search for a specific IP (in the interface variable), I can see the record being returned. How can I modify the lookup to return all IPv4 addresses?

- name: Fetch all host DNS records from Infoblox 
   set_fact: 
      all_infoblox_interfaces: "{{ lookup('nios', 'record:host_ipv4addr', filter={'ipv4addr': interface}, provider=nios_provider)}}"

Re: Ansible lookup for ipv4addr not returning all entries

Moderator
Moderator
Posts: 321
3950     1

I'm not very experienced with the Ansible collection, but it seems to me that the Ansible lookup routine is designed only to look for host records, and will not return all record types.  If you're more interested in other record types, you may be better off using direct WAPI calls, or the Python infoblox-client module.

Re: Ansible lookup for ipv4addr not returning all entries

New Member
Posts: 2
3951     1

Thanks, I could accomplish the same using Python infoblox-client library

from infoblox_client import connector
conn = connector.Connector(opts)
ipv4_records = conn.get_object("record:host_ipv4addr", max_results=10000)

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You