Reply

Ansible lookup fixed address

megabreit
Techie
Posts: 4
134     0

I'm running Ansible 2.8 and trying to view a fixed address object. I thought this would be similar to viewing a host object, but unfortunately it isn't.

Does anybody have an example on how to view fixed addresses? Is there a reference of what objects can be viewed with the lookup module?

 

Using:

- name: query fixed address
    set_fact:
      fixed: "{{ lookup('nios','fixedaddress','1.1.1.1', provider=nios_provider) }}"

 

This displays not just the entry of 1.1.1.1 but a lot with no additional information like mac addresses or dhcp options:

ok: [nios] => {
"msg": "Query result [{u'_ref': u'fixedaddress/XXXXXXX:2.2.2.2/default', u'ipv4addr': u'2.2.2.2', u'network_view': u'default'}, {u'_ref': u'fixedaddress/XXXX:3.3.3.3/default', ....

 

Any hints?

 

Re: Ansible lookup fixed address

Adviser
Posts: 84
135     0

Hi,

 

You can get the fixed address by using the lookup plugin as below.

   - name: get fixedaddress
     set_fact:
       address: "{{ lookup('nios', 'fixedaddress', filter={'ipv4addr': '1.1.1.1'}, return_fields=['mac','options'] provider=nios_provider) }}"
   - name: display fixedaddressr 1.1.1.1
     debug:
       msg: "{{ address}}"

Hope this helps,

Krishna Vasudevan

Re: Ansible lookup fixed address

[ Edited ]
megabreit
Techie
Posts: 4
135     0

Hello,

 

this looks a bit better. Thanks! But how do I know what return fields are available? Is there a way to display all fields of a certain fixed address? I also didn't know about the filter thing. What options/choices are available for filtering?

 

Regards,

Mega

 

Re: Ansible lookup fixed address

Adviser
Posts: 84
135     0

Hi,

 

The Infoblox APIs return a selected set of fields by default. All the additional fields will have to be requested specifically.

 

In the case of fixedaddress, it only returns ipv4addr, network_view by default.

 

To know all the fields supported, you can run a schema using curl, like below.

curl -k -u admin:infoblox -X GET "https://127.0.0.1/wapi/v2.10/fixedaddress?_schema"

For the filter parameter, all the searchable fields can be entered.

 

Regards,

Krishna

Re: Ansible lookup fixed address

megabreit
Techie
Posts: 4
135     0

Ok, I'll take a look into this. Thanks!

Do you know the guy who is in charge for the examples in the Infoblox Ansible module documentation?

It would be great when there were a few more examples like yours :-)

 

Regards,

Mega

 

Re: Ansible lookup fixed address

[ Edited ]
megabreit
Techie
Posts: 4
135     0

OK. Going further. As you described, all searchable fields can be viewed with the filter. This is working now.

But how can I view e.g. the Next Server from the bootp/pxe section? Or the Boot file?

nextserver is not searchable, use_nextserver contains "false".

Is there a list of the field names and the corresponding gui elements? How are things displayed when there is some confguration done for the whole network and e.g. the boot file name is inherited?

 

Thanks in advance,

Mega

 

 

Showing results for 
Search instead for 
Do you mean 

Recommended for You