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://<redacted>, 
token=<redacted>)""
  [40]=>
  string(6) "    },"
  [41]=>
  string(20) "    "changed": false"

Any pointers would be greatly appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5517728f-a5b1-4628-9725-a42e30351a53n%40googlegroups.com.

Reply via email to