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

How to solve invalid IP address or invalid reverse zone error for Ansible nios_ptr_record

[ Edited ]
New Member
Posts: 1
5177     0

Situation:
I'm using ansible infoblox-client to call the infoblox api in our organization to retrieve next available IP address, set A record and PTR record.

 

Problem:
When I run my playbook, I get the following error during the task that creates the PTR Record:

 

"Client.Ibap.Data.Conflict... An invalid IP address or reverse zone was specified."

 

Full JSON output of error:

{
    "code": "Client.Ibap.Data.Conflict",
    "_ansible_no_log": false,
    "changed": false,
    "invocation": {
        "module_args": {
            "comment": null,
            "ptrdname": "infoblox_test.datacenter1.net",
            "name": null,
            "extattrs": null,
            "provider": {
                "username": "user1",
                "wapi_version": "2.1",
                "http_request_timeout": 10,
                "silent_ssl_warnings": true,
                "http_pool_connections": 10,
                "max_results": 1000,
                "max_retries": 3,
                "http_pool_maxsize": 10,
                "host": "ddi.internal.net",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "validate_certs": false
            },
            "ipv4addr": "###.##.###.#",
            "state": "present",
            "ipv4": "###.##.###.#",
            "ttl": null,
            "ipv6addr": null,
            "view": null
        }
    },
    "operation": "create_object",
    "type": "AdmConDataError",
    "msg": "An invalid IP address or reverse zone was specified."
}

Here's my playbook:

---
- hosts: localhost
  gather_facts: false
  tasks: 
    - name: Include infoblox_vault
      include_vars: 
        file: 'infoblox_vault.yml'
    - name: Install infoblox-client for DDI
      pip:
        name: infoblox-client
      environment:
        HTTP_PROXY: http://my-company-proxy.net:8080
        HTTPS_PROXY: http://my-company-proxy.net:8080
      delegate_to: localhost

    - name: Check if DNS Record exists
      set_fact:
        vmwareCreateVM_ddiRecord: "{{ lookup('nios', 'record:a', filter={
                                      'name': 'infoblox_test.datacenter1.net' },
                                provider={'host': 'ddi.internal.net',
                                         'username': infoblox_username,
                                         'password': infoblox_password }) }}"
    - debug: 
        msg: check var vmwareCreateVM_ddiRecord "{{ vmwareCreateVM_ddiRecord }}"

    - name: DDI
      block:
        - name: Retrieve available IP for network {{ 1##.2#.###.#/## }}
          set_fact:
            vmwareCreateVM_ipaddr: "{{ lookup('nios_next_ip',
                                              '1##.2#.###.#/##',
                                              provider={'host': 'ddi.internal.net',
                                                       'username': infoblox_username,
                                                       'password': infoblox_password })}}"
        - debug:
            msg: check vmwareCreateVM_ipaddr "{{ vmwareCreateVM_ipaddr }}"
        - debug:
            msg: check vmwareCreateVM_ipaddr bracket zero "{{ vmwareCreateVM_ipaddr[0] }}"
        - name: Creating A record for infoblox_test.datacenter1.net.
          nios_a_record:
            name: "infoblox_test.datacenter1.net"
            ipv4: "{{ vmwareCreateVM_ipaddr[0] }}"
            state: present
            extattrs:
              Owner: Sys Admins
              Site: HQ
            provider:
              host: ddi.internal.net
              username: "{{ infoblox_username }}"
              password: "{{ infoblox_password }}"
          connection: local

        - name: Creating PTR Record infoblox_test.datacenter1.net
          nios_ptr_record:
            ipv4: "{{ vmwareCreateVM_ipaddr[0] }}"
            ptrdname: "infoblox_test.datacenter1.net"
            state: present
            provider:
              host: "ddi.internal.net"
              username: "{{ infoblox_username }}"
              password: "{{ infoblox_password }}"
          connection: local

When I use `debug` to print vmwareCreateVM_ipaddr[0] I get `\"1##.2#.###.#\"`

 

Any suggestions what I'm doing wrong?  Thank you!

 

Update:
To narrow down whether the issue is invalid IP or invalid zone, I hard coded the ipv4 variable and got the same error message. What might I explore as solutions if the zone is invalid?

Re: How to solve invalid IP address or invalid reverse zone error for Ansible nios_ptr_record

Adviser
Posts: 181
5178     0

Hi,

 

This could be because you do not have the appropriate IPv4 reverse mapping zone defined that corresponds to the IPv4 subnet.

 

First create a corresponding reverse mapping zone and then try out the playbook again.

 

You can verify by running the following API call:

 

curl -k -u admin:infoblox -H 'content-type: application/json' -X POST "https://grid-master/wapi/v2.7/record:ptr?_return_fields%2B=ptrdname,ipv4addr&_return_as_object=1" -d '{"ptrdname":"infoblox_test.datacenter1.net","ipv4addr":"1##.2#.###.#"}'

 

 

Let me know if this helps,

Thanks and Regards,

Krishna Vasudevan

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You

Demo: Infoblox IPAM plug-in integration with OpenStack Newton