Introducing SOC Insights for BloxOne Threat Defense: Boost your SOC efficiency with AI-driven insights to eliminate manual work and accelerate investigation and response times. Read the blog announcement here.

API & Integration, DevOps,NetOps,SecOps

Reply

Ansible nios_host_record create error: Client.Ibap.Data.NotFound

New Member
Posts: 4
8323     0

I have an issue with Infoblox and Ansible not being able to create a host record.  I’m using the info from https://www.infoblox.com/wp-content/uploads/infoblox-deployment-guide-infoblox-and-ansible-integrati...

And the git repo referenced in the PDF: https://github.com/infobloxopen/infoblox-ansible-playbooks.git

 

The system is always returning an error like it needs something done prior to the request but none of the documentation says anything about ordering.

From the repo using create_host.yml with the proper credentials, it returns the following error.

The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_nios_host_record_payload_iEQkF0/ansible_nios_host_record_payload.zip/ansible/module_utils/net_tools/nios/api.py", line 151, in _invoke_method
    return method(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/infoblox_client/connector.py", line 42, in callee
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/infoblox_client/connector.py", line 366, in create_object
    code=r.status_code)

fatal: [localhost]: FAILED! => {
    "changed": false,
    "code": "Client.Ibap.Data.NotFound",
    "invocation": {
        "module_args": {
            "aliases": null,
            "comment": null,
            "configure_for_dns": true,
            "extattrs": null,
            "ipv4": [
                {
                    "address": "10.109.182.21",
                    "configure_for_dhcp": null,
                    "ipv4addr": "10.109.182.21",
                    "mac": null
                }
            ],
            "ipv4addrs": [
                {
                    "address": "10.109.182.21",
                    "configure_for_dhcp": null,
                    "ipv4addr": "10.109.182.21",
                    "mac": null
                }
            ],
            "ipv6addrs": null,
            "name": "hmdc-21.lab.c-cor.com",
            "provider": {
                "host": "gridmanager.arrisi.com",
                "http_pool_connections": 10,
                "http_pool_maxsize": 10,
                "http_request_timeout": 10,
                "max_results": 1000,
                "max_retries": 3,
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "silent_ssl_warnings": true,
                "ssl_verify": false,
                "username": "lbrigman",
                "wapi_version": "2.1"
            },
            "state": "present",
            "ttl": null,
            "view": "ansibleDnsView"
        }
    },
    "msg": "View ansibleDnsView not found",
    "operation": "create_object",
    "type": "AdmConDataNotFoundError"
}

 

There seems to be an order of operations but moving up the chain to create the views (as the default view is unavailable), I eventually get an error as no permissions to create.

[lbrigman@lb-devel7 infoblox-test]$ cat nios_netview.yml

---

 

- hosts: localhost

  vars_files:

    - files/nios.yml

  connection: local

  tasks:

   - name: create network view

     nios_network_view:

       name: ansibleNetView

       extattrs:

         Site: Test Site

       comment: Created with Ansible

       state: present

       provider: "{{ nios_provider }}"

[lbrigman@lb-devel7 infoblox-test]$ vi files/nios.yml

[lbrigman@lb-devel7 infoblox-test]$ ap nios_netview.yml

 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit

localhost does not match 'all'

 

 

PLAY [localhost] *******************************************************************************

 

TASK [Gathering Facts] *************************************************************************

ok: [localhost]

 

TASK [create network view] *********************************************************************

fatal: [localhost]: FAILED! => {"changed": false, "code": "Client.Ibap.Data.Conflict", "msg": "Write permission for the network view 'ansibleNetView' is required for this operation.", "operation": "create_object", "type": "AdmConDataError"}

Re: Ansible nios_host_record create error: Client.Ibap.Data.NotFound

New Member
Posts: 4
8324     0

Tried the 2.7 samples against system and got similar results to the 2.5 samples.

Here is the traceback.

The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_nios_a_record_payload_VntM1g/ansible_nios_a_record_payload.zip/ansible/module_utils/net_tools/nios/api.py", line 151, in _invoke_method
    return method(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/infoblox_client/connector.py", line 42, in callee
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/infoblox_client/connector.py", line 366, in create_object
    code=r.status_code)

fatal: [localhost]: FAILED! => {
    "changed": false, 
    "code": "Client.Ibap.Data.NotFound", 
    "invocation": {
        "module_args": {
            "comment": "Created with Ansible", 
            "extattrs": null, 
            "ipv4": "10.109.182.21", 
            "ipv4addr": "10.109.182.21", 
            "name": "hmdc-21.lab.c-cor.com", 
            "provider": {
                "host": "gridmanager.arrisi.com", 
                "http_pool_connections": 10, 
                "http_pool_maxsize": 10, 
                "http_request_timeout": 10, 
                "max_results": 1000, 
                "max_retries": 3, 
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
                "silent_ssl_warnings": true, 
                "ssl_verify": false, 
                "username": "lbrigman", 
                "wapi_version": "2.1"
            }, 
            "state": "present", 
            "ttl": null, 
            "view": "default"
        }
    }, 
    "msg": "View default not found", 
    "operation": "create_object", 
    "type": "AdmConDataNotFoundError"
}

Re: Ansible nios_host_record create error: Client.Ibap.Data.NotFound

Adviser
Posts: 109
8324     0

NIOS always has at least one DNS View in each Network View and by default, these are named "default". If you specify a DNS View that does not exist, this error is to be expected.

 

Based on your second attempt, I am guessing that the default DNS view has been deleted or renamed. If you are using the default DNS View, you can try ommitting/commenting out the view parameter so that it will default but if the default DNS View is no longer present, that will prevent this from working.

 

To verify your Network View and DNS View names:

  1. Navigate to Data Management -> DNS
  2. Locate the dropdown menu at the very top-left of the window, just below the Infoblox logo. This is the Network View that you have currently selected. You can expand this menu and select a different Network View if appropriate.
  3. The DNS View name can be seen directly below the Zones tab.

Heere is a screenshot with arrows pointing to the Network Views menu and the label for the DNS View name:

Network and DNS View.jpg

 

Whatever this name is will be what you need to use in your Ansible plays. If you have renamed the default DNS View name to something else and there is no requirement for that, it might make things easier for if you change this back. To do so, click on the edit (blue pencil) button to the right of the DNS View name.

 

If you are working in a Network View other than the default Network View (which Ansible uses by default), you will need to make sure that you specify this with the view property, where the Network View name is appended after the DNS View name (with a dot in between the two). Example:

 

view: "default.netview2"

 

For your playbook to create a Network View, this complains about permissions so I would attempt to run this using an account enabled as a superuser to rule out missing permissions as the issue. For a non-superuser to be able to create a Network View, it will require Read/Write for All Network Views under the (global) DHCP or IPAM permission type.

 

NetView_Permissions.jpg

 

 

However, I suspect that you don't even need/want to create new Network Views right now. New views would only be created for specific requirements (segregration of data, handling of overlapping address space, etc. If in doubt or you are just getting started/testing, try to stick to the default Network and DNS Views.

 

 

 

Hopefully this helps you move forward with your testing.

 

Regards,

Tony

Re: Ansible nios_host_record create error: Client.Ibap.Data.NotFound

New Member
Posts: 4
8324     0

Either my permissions are wrong or you are using a newer version of the interface as I don't get the network view drop-down.

 

With the details provided about the DNS view, I was successful in finding what was needed to add to the view line to get the task to succeed.

It would be good to have a play or an example that would fetch the network and dns views that are configured.  

 

Re: Ansible nios_host_record create error: Client.Ibap.Data.NotFound

New Member
Posts: 4
8324     0

In our case, the default DNS view was removed and others were added.

Not sure about the Network views as I don't have access to see them from the UI.

Re: Ansible nios_host_record create error: Client.Ibap.Data.NotFound

Adviser
Posts: 109
8324     0

@lbrigman wrote:

In our case, the default DNS view was removed and others were added.

Not sure about the Network views as I don't have access to see them from the UI.


If permissions are not an issue, you can also review these under the Administration -> Network Views tab in your Grid Manager GUI.

 

For a listing of Network and DNS Views, there is a lookup plugin that allows you to fetch objects from NIOS and examples for this can be found at https://docs.ansible.com/ansible/latest/scenario_guides/guide_infoblox.html#retrieving-all-network-v....

 

The above reference provides an example for how to get back a specific DNS View. To get back a list of all DNS Views, just remove the filter:

 

dns_views: "{{ lookup('nios', 'view', provider={'host': '192.168.1.2', 'username': 'admin', 'password': 'infoblox'}) }}"

 

 

 

Regards,

Tony

Showing results for 
Search instead for 
Did you mean: 

Recommended for You