Reply

Ansible lookups

New Member
Posts: 1
4635     0

Hi all,

 

I'm trying to use Infoblox with Ansible for both A-Record and PTR. How can I do this? I'm trying to find a fqdn from an ip, or an ip from a fqdn.

 

Thanks.

 

 

Re: Ansible lookups

Adviser
Posts: 181
4635     0

Hi,

 

You can do so by using the lookup plugins in your playbook as below.

---

- hosts: localhost
  vars:
    nios_provider:
      host: grid-master
      username: admin
      password: infoblox

  connection: local
  tasks:
# Get the list of A records
   - name: get member list
     set_fact:
       arecords: "{{ lookup('nios', 'record:a', provider=nios_provider) }}"
   - name: display all A records
     debug:
       msg: "{{ arecords}}"
# Get an A record using its name
   - name: get A record
     set_fact:
       arecord: "{{ lookup('nios', 'record:a', filter={'name': 'a.demo.com'}, provider=nios_provider) }}"
   - name: display A record a.demo.com
     debug:
       msg: "{{ arecord}}"
# Get an A record using its IP address
   - name: get A record
     set_fact:
       arecord: "{{ lookup('nios', 'record:a', filter={'ipv4addr': '192.168.1.2'}, provider=nios_provider) }}"
   - name: display A record for 192.168.1.2
     debug:
       msg: "{{ arecord}}"
# Get all PTR records
   - name: get all PTR records
     set_fact:
       ptrrecord: "{{ lookup('nios', 'record:ptr', provider=nios_provider) }}"
   - name: display list of PTR records
     debug:
       msg: "{{ ptrrecord}}"
# Get PTR record using its name
   - name: get PTR record
     set_fact:
       ptrrecord: "{{ lookup('nios', 'record:ptr', filter={'ptrdname': 'a.demo.com'}, provider=nios_provider) }}"
   - name: display PTR record a.demo.com
     debug:
       msg: "{{ ptrrecord}}"

Hope this helps,

Krishna Vasudevan

Re: Ansible lookups

New Member
Posts: 1
4635     0

Is there any way to get records from specific dns view instead of getting all the records

Re: Ansible lookups

Adviser
Posts: 181
4635     0

Hi,

 

You can add it as part of filters.

# Get an A record in a view
   - name: get A record
     set_fact:
       arecord: "{{ lookup('nios', 'record:a', filter={'view': 'test'}, provider=nios_provider) }}"
   - name: display A records in view test
     debug:
       msg: "{{ arecord}}"

Hope this helps,

Krishna

Re: Ansible lookups

[ Edited ]
Techie
Posts: 9
4635     0

Like in GUI...how can we do global search using  lookup... For a single host i need to get return  all the types of records..  including IPV4 , VLAN, network_view, comments  and all the DNS related records aswell (a, cname, mx, ipv4, host..etc.) 

 

if i need to decom a server i need find all the entries related a single host/server ..using ansible

 

Re: Ansible lookups

Adviser
Posts: 181
4635     0

Hi,

 

Can you try this and see if this is what you are looking for?

# Search against IP address
   - name: search for an IP address
     set_fact:
       iprecord: "{{ lookup('nios', 'search', filter={'address': '10.10.10.1'}, provider=nios_provider) }}"
   - name: display all the records associated with this IP address
     debug:
       msg: "{{ iprecord}}"

Regards,

Krishna

Re: Ansible lookups

[ Edited ]
Techie
Posts: 9
4635     0

HI Krishna,

 

sorry its not working im using 

ansible --version
ansible 2.9.0

python version = 3.6.8 

 

Method 1 (which you suggestes)

Error:

Failed on object search with url https://infoblox.xxx.net/wapi/v2.1/search?address=10.12.131.81&_max_results=100000: b'{ "Error": "AdmConProtoError: Unknown argument/field: \'address\'", \n "code": "Client.Ibap.Proto", \n "text": "Unknown argument/field: \'address\'"\n}'
Failed on object search with url https://infoblox.xxx.net/wapi/v2.1/search?address=10.12.131.81&_max_results=100000&_proxy_search=GM: b'{ "Error": "AdmConProtoError: Unknown argument/field: \'address\'", \n "code": "Client.Ibap.Proto", \n "text": "Unknown argument/field: \'address\'"\n}'

========================================================

wif ref to

https://ipam.illinois.edu/wapidoc/objects/search.html

 

i tried Method 2: using ansible uri module GET method as below. this is also not working. 

url: "https://infoblox.xxx.net/wapi/v2.1/search?fqdn={{host}}"

user: "{{username}}"
password: "{{password}}"
force_basic_auth: yes
method: get

Error:

fatal: 1/1 [localhost]: FAILED! => {"cache_control": "no-cache, no-store", "changed": false, "connection": "close", "content": "{ \"Error\": \"AdmConProtoError: Unknown argument/field: 'fqdn'\", \n \"code\": \"Client.Ibap.Proto\", \n \"text\": \"Unknown argument/field: 'fqdn'\"\n}", "content_type": "application/json", "date": "Thu, 18 Feb 2021 22:24:59 GMT", "elapsed": 0, "json": {"Error": "AdmConProtoError: Unknown argument/field: 'fqdn'", "code": "Client.Ibap.Proto", "text": "Unknown argument/field: 'fqdn'"}, "msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request", "pragma": "no-cache", "redirected": false, "set_cookie": "ibapauth=\"client=API,group=READ%20ONLY,ctime=1613687099,timeout=28800,mtime=1613687099,ip=10.0.125.125,auth=TACACS%2B,user=xpctr570068,s0N5+7LTEN1FhBzE3slvjDAin28FRSK58k8\"; httponly; Path=/", "status": 400, "strict_transport_security": "max-age=31536000; includeSubDomains", "transfer_encoding": "chunked", "url": "https://infoblox.xxx.net/wapi/v2.1/search?fqdn=niostest19.xxx.test", "x_content_type_options": "nosniff", "x_frame_options": "SAMEORIGIN", "x_xss_protection": "1; mode=block"}

--------------------------------------------------------

========================================================================

this Method 3: is working with ip address

as like with uri module get method.

 

 url: "https://infoblox.xxx.net/wapi/v2.1/search?address=10.2.6.6 

user: "{{username}}"
password: "{{password}}"
force_basic_auth: yes
method: get

 

  but the result is  not bringing all the record ..only IP related record its bringing i need to get cname record also. will be easy if work with search?fqdn=

 

 

so please help for all the 3 methods.

Re: Ansible lookups

Techie
Posts: 9
4635     0

Hi all any updates on this please

Re: Ansible lookups

Adviser
Posts: 181
4635     0

Hi,

 

Looks like WAPI version 2.1 does not support the fqdn filter. You can try with a later version of WAPI like below:

API: https://grid-master.infoblox.com/wapi/v2.10/search?fqdn~=demo.com

Sample Output:
[
    {
        "_ref": "record:srv/ZG5zLmJpbmRfc3J2JC5fZGVmYXVsdC5jb20uaW5mb2Jsb3hkZW1vLmFkLl9tc2Rjcy9kYy5fc2l0ZXMuZGVmYXVsdC1maXJzdC1zaXRlLW5hbWUuX3RjcC5fbGRhcC8wLzEwMC8zODkvZGMyLmFkLmluZm9ibG94ZGVtby5jb20:_ldap._tcp.default-first-site-name._sites.dc._msdcs.ad.infobloxdemo.com/default",
        "name": "_ldap._tcp.default-first-site-name._sites.dc._msdcs.ad.infobloxdemo.com",
        "port": 389,
        "priority": 0,
        "target": "dc2.ad.infobloxdemo.com",
        "view": "default",
        "weight": 100
    },
    {
        "_ref": "record:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmluZm9ibG94ZGVtby5hZC5fbXNkY3MsZ2MsMTkyLjE2OC40LjIy:gc._msdcs.ad.infobloxdemo.com/default",
        "ipv4addr": "192.168.4.22",
        "name": "gc._msdcs.ad.infobloxdemo.com",
        "view": "default"
    },
.....]

In order to find the latest version of WAPI supported by your appliance, look at the values listed under supported_versions in the following API call:

API: https://grid-master.infoblox.com/wapi/v1.0/?_schema

Output:
{
    "requested_version": "1.0",
    "supported_objects": [
        "ipv4address",
        "ipv6address",
        "ipv6network",
        "ipv6networkcontainer",
        "ipv6range",
        "macfilteraddress",
        "network",
        "networkcontainer",
        "networkview",
        "range",
        "record:a",
        "record:aaaa",
        "record:cname",
        "record:host",
        "record:host_ipv4addr",
        "record:mx",
        "record:ptr",
        "record:srv",
        "record:txt",
        "search"
    ],
    "supported_versions": [
        "1.0",
        "1.1",
        "1.2",
        "1.2.1",
        "1.3",
        "1.4",
        "1.4.1",
        "1.4.2",
        "1.5",
        "1.6",
        "1.6.1",
        "1.7",
        "1.7.1",
        "1.7.2",
        "1.7.3",
        "1.7.4",
        "1.7.5",
        "2.0",
        "2.1",
        "2.1.1",
        "2.1.2",
        "2.10",
        "2.10.1",
        "2.10.2",
        "2.10.3",
        "2.10.5",
        "2.2",
        "2.2.1",
        "2.2.2",
        "2.3",
        "2.3.1",
        "2.4",
        "2.5",
        "2.6",
        "2.6.1",
        "2.7",
        "2.7.1",
        "2.7.2",
        "2.7.3",
        "2.8",
        "2.9",
        "2.9.1",
        "2.9.5"
    ]
}

Regards,

Krishna

Re: Ansible lookups

Techie
Posts: 9
4635     0

@kvasudevan wrote:

Hi,

 

Looks like WAPI version 2.1 does not support the fqdn filter. You can try with a later version of WAPI like below:

API: https://grid-master.infoblox.com/wapi/v2.10/search?fqdn~=demo.com

Sample Output:
[
    {
        "_ref": "record:srv/ZG5zLmJpbmRfc3J2JC5fZGVmYXVsdC5jb20uaW5mb2Jsb3hkZW1vLmFkLl9tc2Rjcy9kYy5fc2l0ZXMuZGVmYXVsdC1maXJzdC1zaXRlLW5hbWUuX3RjcC5fbGRhcC8wLzEwMC8zODkvZGMyLmFkLmluZm9ibG94ZGVtby5jb20:_ldap._tcp.default-first-site-name._sites.dc._msdcs.ad.infobloxdemo.com/default",
        "name": "_ldap._tcp.default-first-site-name._sites.dc._msdcs.ad.infobloxdemo.com",
        "port": 389,
        "priority": 0,
        "target": "dc2.ad.infobloxdemo.com",
        "view": "default",
        "weight": 100
    },
    {
        "_ref": "record:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmluZm9ibG94ZGVtby5hZC5fbXNkY3MsZ2MsMTkyLjE2OC40LjIy:gc._msdcs.ad.infobloxdemo.com/default",
        "ipv4addr": "192.168.4.22",
        "name": "gc._msdcs.ad.infobloxdemo.com",
        "view": "default"
    },
.....]

In order to find the latest version of WAPI supported by your appliance, look at the values listed under supported_versions in the following API call:

API: https://grid-master.infoblox.com/wapi/v1.0/?_schema

Output:
{
    "requested_version": "1.0",
    "supported_objects": [
        "ipv4address",
        "ipv6address",
        "ipv6network",
        "ipv6networkcontainer",
        "ipv6range",
        "macfilteraddress",
        "network",
        "networkcontainer",
        "networkview",
        "range",
        "record:a",
        "record:aaaa",
        "record:cname",
        "record:host",
        "record:host_ipv4addr",
        "record:mx",
        "record:ptr",
        "record:srv",
        "record:txt",
        "search"
    ],
    "supported_versions": [
        "1.0",
        "1.1",
        "1.2",
        "1.2.1",
        "1.3",
        "1.4",
        "1.4.1",
        "1.4.2",
        "1.5",
        "1.6",
        "1.6.1",
        "1.7",
        "1.7.1",
        "1.7.2",
        "1.7.3",
        "1.7.4",
        "1.7.5",
        "2.0",
        "2.1",
        "2.1.1",
        "2.1.2",
        "2.10",
        "2.10.1",
        "2.10.2",
        "2.10.3",
        "2.10.5",
        "2.2",
        "2.2.1",
        "2.2.2",
        "2.3",
        "2.3.1",
        "2.4",
        "2.5",
        "2.6",
        "2.6.1",
        "2.7",
        "2.7.1",
        "2.7.2",
        "2.7.3",
        "2.8",
        "2.9",
        "2.9.1",
        "2.9.5"
    ]
}

Regards,

Krishna


Thanks its working


@kvasudevan wrote:

Hi,

 

Looks like WAPI version 2.1 does not support the fqdn filter. You can try with a later version of WAPI like below:

API: https://grid-master.infoblox.com/wapi/v2.10/search?fqdn~=demo.com

Sample Output:
[
    {
        "_ref": "record:srv/ZG5zLmJpbmRfc3J2JC5fZGVmYXVsdC5jb20uaW5mb2Jsb3hkZW1vLmFkLl9tc2Rjcy9kYy5fc2l0ZXMuZGVmYXVsdC1maXJzdC1zaXRlLW5hbWUuX3RjcC5fbGRhcC8wLzEwMC8zODkvZGMyLmFkLmluZm9ibG94ZGVtby5jb20:_ldap._tcp.default-first-site-name._sites.dc._msdcs.ad.infobloxdemo.com/default",
        "name": "_ldap._tcp.default-first-site-name._sites.dc._msdcs.ad.infobloxdemo.com",
        "port": 389,
        "priority": 0,
        "target": "dc2.ad.infobloxdemo.com",
        "view": "default",
        "weight": 100
    },
    {
        "_ref": "record:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmluZm9ibG94ZGVtby5hZC5fbXNkY3MsZ2MsMTkyLjE2OC40LjIy:gc._msdcs.ad.infobloxdemo.com/default",
        "ipv4addr": "192.168.4.22",
        "name": "gc._msdcs.ad.infobloxdemo.com",
        "view": "default"
    },
.....]

In order to find the latest version of WAPI supported by your appliance, look at the values listed under supported_versions in the following API call:

API: https://grid-master.infoblox.com/wapi/v1.0/?_schema

Output:
{
    "requested_version": "1.0",
    "supported_objects": [
        "ipv4address",
        "ipv6address",
        "ipv6network",
        "ipv6networkcontainer",
        "ipv6range",
        "macfilteraddress",
        "network",
        "networkcontainer",
        "networkview",
        "range",
        "record:a",
        "record:aaaa",
        "record:cname",
        "record:host",
        "record:host_ipv4addr",
        "record:mx",
        "record:ptr",
        "record:srv",
        "record:txt",
        "search"
    ],
    "supported_versions": [
        "1.0",
        "1.1",
        "1.2",
        "1.2.1",
        "1.3",
        "1.4",
        "1.4.1",
        "1.4.2",
        "1.5",
        "1.6",
        "1.6.1",
        "1.7",
        "1.7.1",
        "1.7.2",
        "1.7.3",
        "1.7.4",
        "1.7.5",
        "2.0",
        "2.1",
        "2.1.1",
        "2.1.2",
        "2.10",
        "2.10.1",
        "2.10.2",
        "2.10.3",
        "2.10.5",
        "2.2",
        "2.2.1",
        "2.2.2",
        "2.3",
        "2.3.1",
        "2.4",
        "2.5",
        "2.6",
        "2.6.1",
        "2.7",
        "2.7.1",
        "2.7.2",
        "2.7.3",
        "2.8",
        "2.9",
        "2.9.1",
        "2.9.5"
    ]
}

Regards,

Krishna


Thanks Krishna its working

Re: Ansible lookups

New Member
Posts: 3
4635     0

HI Krishna,

 

I am working on to get IP address associated with MAC. so by provising mac wanted to fetch IP details 

can you please suggest the ansible nios_lookup format to achive this.

I am doing below but not working

 

ipdetails: "{{ lookup('nios', 'search', filter={mac_address: '00:00:00:00:00:00'}, provider=nios_provider) }}"

Re: Ansible lookups

Adviser
Posts: 181
4635     0

Hi,

 

Could you please share the error details? It would be easier for me to guide you with the actual query.

 

I tried this and it worked:

---
  
- hosts: localhost
  vars:
    nios_provider:
      host: grid-master.demo.com
      username: admin
      password: infoblox
      wapi_version: '2.10'

  connection: local
  tasks:
   - name: fetch options
     set_fact:
             host: "{{ lookup('nios', 'search', filter={'mac_address':'00:00:00:00:00:00'},provider=nios_provider) }}"
   - name: display options
     debug:
       msg: "{{ host }}"

Regards,

Krishna Vasudevan

Re: Ansible lookups

New Member
Posts: 3
4635     0

Hello Krishna 

 

I am getting multiple IP from that leases. as there is leases in history also showing. SO I filter it with its state Active but some results state not showing at all

can you let me know how to fetch Active IP from MAC

that would be great

Re: Ansible lookups

New Member
Posts: 1
4635     0

Hey guys I am getting a similar error and I am unable to get a host record created!

 

 

*********PLAYBOOK**************

 

---
- hosts: nios
connection: local
tasks:
- name: return the next available IP addresses for network 10.0.0.128/25
set_fact:
ipaddr: "{{ lookup('nios_next_ip', '10.0.0.128/25', provider=nios_provider) }}"
provider: "{{nios_provider}}"
- name: Print the range of IPs calculated above
debug:
var: ipaddr
- name: configure a host
nios_host_record:
name: test2.rockefeller.internal
ipv4addrs:
- ipv4addr: "{{ item }}"
comment: this is a test comment
state: present
provider: "{{nios_provider}}"
loop: "{{ ipaddr }}"

 

 

 

 

*************RESULT*****

 


mbmbp:rcode mbachhav$ ansible-playbook create-hostrecord-byhostname.yml

PLAY [nios] **************************************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************************************
[WARNING]: Platform darwin on host opus.rockefeller.edu is using the discovered Python interpreter at /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9, but future
installation of another Python interpreter could change the meaning of that path. See https://docs.ansible.com/ansible-core/2.14/reference_appendices/interpreter_discovery.html for
more information.
ok: [opus.rockefeller.edu]

TASK [return the next available IP addresses for network 10.0.0.128/25] **************************************************************************************************************
ok: [opus.rockefeller.edu]

TASK [Print the range of IPs calculated above] ***************************************************************************************************************************************
ok: [opus.rockefeller.edu] => {
"ipaddr": [
"10.0.0.140"
]
}

TASK [configure a host] **************************************************************************************************************************************************************
failed: [opus.rockefeller.edu] (item=10.0.0.140) => {"ansible_loop_var": "item", "changed": false, "item": "10.0.0.140", "module_stderr": "Failed on object search with url https://opus.rockefeller.edu/wapi/v2.9.7/record%3Ahost?name=test2.rockefeller.internal&view=default&...: b'{ \"Error\": \"AdmConDataNotFoundError: View default not found\", \\n \"code\": \"Client.Ibap.Data.NotFound\", \\n \"text\": \"View default not found\"\\n}'\nFailed on object search with url https://opus.rockefeller.edu/wapi/v2.9.7/record%3Ahost?name=test2.rockefeller.internal&view=default&...: b'{ \"Error\": \"AdmConDataNotFoundError: View default not found\", \\n \"code\": \"Client.Ibap.Data.NotFound\", \\n \"text\": \"View default not found\"\\n}'\nTraceback (most recent call last):\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/infoblox_client/connector.py\", line 317, in get_object\n return self._handle_get_object(obj_type, query_params, extattrs,\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/infoblox_client/connector.py\", line 354, in _handle_get_object\n return self._get_object(obj_type, url)\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/infoblox_client/connector.py\", line 370, in _get_object\n r.raise_for_status()\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/requests/models.py\", line 1021, in raise_for_status\n raise HTTPError(http_error_msg, response=self)\nrequests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://opus.rockefeller.edu/wapi/v2.9.7/record%3Ahost?name=test2.rockefeller.internal&view=default&...n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/infoblox_client/connector.py\", line 53, in callee\n return func(*args, **kwargs)\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/infoblox_client/connector.py\", line 321, in get_object\n return self._handle_get_object(obj_type, query_params,\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/infoblox_client/connector.py\", line 354, in _handle_get_object\n return self._get_object(obj_type, url)\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/infoblox_client/connector.py\", line 370, in _get_object\n r.raise_for_status()\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/requests/models.py\", line 1021, in raise_for_status\n raise HTTPError(http_error_msg, response=self)\nrequests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://opus.rockefeller.edu/wapi/v2.9.7/record%3Ahost?name=test2.rockefeller.internal&view=default&...n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/Users/mbachhav/.ansible/tmp/ansible-tmp-1681498563.760345-44876-203650189670987/AnsiballZ_nios_host_record.py\", line 107, in <module>\n _ansiballz_main()\n File \"/Users/mbachhav/.ansible/tmp/ansible-tmp-1681498563.760345-44876-203650189670987/AnsiballZ_nios_host_record.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/Users/mbachhav/.ansible/tmp/ansible-tmp-1681498563.760345-44876-203650189670987/AnsiballZ_nios_host_record.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.infoblox.nios_modules.plugins.modules.nios_host_record', init_globals=dict(_module_fqn='ansible_collections.infoblox.nios_modules.plugins.modules.nios_host_record', _modlib_path=modlib_path),\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 210, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/var/folders/g5/gds8wzqx03s_1clsp2px9vzc0000gn/T/ansible_nios_host_record_payload_usn_to0b/ansible_nios_host_record_payload.zip/ansible_collections/infoblox/nios_modules/plugins/modules/nios_host_record.py\", line 373, in <module>\n File \"/var/folders/g5/gds8wzqx03s_1clsp2px9vzc0000gn/T/ansible_nios_host_record_payload_usn_to0b/ansible_nios_host_record_payload.zip/ansible_collections/infoblox/nios_modules/plugins/modules/nios_host_record.py\", line 367, in main\n File \"/var/folders/g5/gds8wzqx03s_1clsp2px9vzc0000gn/T/ansible_nios_host_record_payload_usn_to0b/ansible_nios_host_record_payload.zip/ansible_collections/infoblox/nios_modules/plugins/module_utils/api.py\", line 279, in run\n File \"/var/folders/g5/gds8wzqx03s_1clsp2px9vzc0000gn/T/ansible_nios_host_record_payload_usn_to0b/ansible_nios_host_record_payload.zip/ansible_collections/infoblox/nios_modules/plugins/module_utils/api.py\", line 609, in get_object_ref\n File \"/var/folders/g5/gds8wzqx03s_1clsp2px9vzc0000gn/T/ansible_nios_host_record_payload_usn_to0b/ansible_nios_host_record_payload.zip/ansible_collections/infoblox/nios_modules/plugins/module_utils/api.py\", line 213, in _invoke_method\n File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/infoblox_client/connector.py\", line 57, in callee\n raise ib_ex.InfobloxConnectionError(reason=e)\ninfoblox_client.exceptions.InfobloxConnectionError: Infoblox HTTP request failed with: 404 Client Error: Not Found for url: https://opus.rockefeller.edu/wapi/v2.9.7/record%3Ahost?name=test2.rockefeller.internal&view=default&...n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP ***************************************************************************************************************************************************************************
opus.rockefeller.edu : ok=3 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

mbmbp:rcode mbachhav$

Re: Ansible lookups

[ Edited ]
New Member
Posts: 1
4635     0

Hi Krishna ,

Im'trying to use the filter option with a variable passed from command line,so the line

host: "{{ lookup('nios', 'search', filter={'mac_address':'00:00:00:00:00:00'},provider=nios_provider) }}"

would be like this

host: "{{ lookup('nios', 'search', filter={'mac_address': '{{ mac_address }}'},provider=nios_provider) }}"

and from command line:

ansible-playbook -e @nios.yml -e "mac_address=00:00:00:00:00:00" my_playbook.yml

 

and it doesn't work.

Have you any suggestion?

Thanks

Showing results for 
Search instead for 
Did you mean: 

Recommended for You