Reply

Ansible lookup fixed address

Authority
Posts: 30
6580     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: 181
6581     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 ]
Authority
Posts: 30
6581     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: 181
6581     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

Authority
Posts: 30
6581     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 ]
Authority
Posts: 30
6581     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

 

 

Re: Ansible lookup fixed address

Authority
Posts: 30
6581     0

2 weeks with no updates. Is there really nobody using Ansible for fixed addresses?

Showing results for 
Search instead for 
Did you mean: 

Recommended for You