Ansible - Searching for a fixed reservation

Options
anontrader
edited June 24 in Automation

Hi all, we are having trouble querying (with the .nios_lookup module). We are not able to look up and search whether an IPv4 address is reserved.

This is the request:
- name: "Query to check whether IP is reserved"     
ansible.builtin.set_fact:       
checkIfIpIsReserved: >-  "{{ lookup('infoblox.nios_modules.nios_lookup', 'fixedaddress',          filter={'ipv4addr': ipToReserve}, provider=nios_provider)}}"


This will successfully call to Infoblox but return an empty object. The documentation isn't clear by what values we can filter for the 'fixedaddress' type, so whenever attempting to filter by type (i.e. 'type':'Reservation') it fails. Does anyone know where I can read into how to search whether an IPv4 address is reserved?

Best Answer

  • mrigank_gupta
    Answer ✓

    Hi I tried to solve this for you here is a ansible playbook. This playbook checks whether a specific IP address is reserved in Infoblox. Sensitive information such as host, username, and password have been replaced with placeholders.
    Dowload from below link