Hi Everyone,
I am building some automation for our Netbox as the source of truth and using webhooks to fire off tasks for things like interface updates and vlan creation / deletions.
The issue I have is that I am trying to pass the device id as a variable to the query for the netbox.nb_lookup collection and it is not working.
I have tried many different ways of building the query, and they all fail in different ways. At least this one returns valid query text in the debug output, but does not run the query.
tasks:
- name: “Get platform from Netbox”
set_fact:
platformos: query({{qryfilter}})
vars:
qryfilter: “‘netbox.netbox.nb_lookup’, ‘devices’, api_filter=‘id={{mydeviceid}}’, api_endpoint={{netbox_url}}, token={{netbox_token}}”
string(80) “TASK [Get platform from Netbox] ************************************************”
[36]=>
string(45) “task path: /home/ansible/get_interface.yml:13”
[37]=>
string(27) “ok: [HP-2530-48G-Demo] => {”
[38]=>
string(22) " “ansible_facts”: {"
[39]=>
string(178) " “platformos”: “query(‘netbox.netbox.nb_lookup’, ‘devices’, api_filter=‘id=15’, api_endpoint=https://, token=)”"
[40]=>
string(6) " },"
[41]=>
string(20) " “changed”: false"
Any pointers would be greatly appreciated.