Multiple variables in api_filter #1067
Unanswered
stasstryukov
asked this question in
Q&A
Replies: 1 comment
-
You need to have spaces between your variables. Here's an example from my code - name: Get all oob subnet prefixes for site {{ netbox_site }} from Netbox
vars:
oob_prefix_filter: "family=4 role=oob site={{ netbox_site_slug }}"
set_fact:
oob_prefixes: "{{ query('netbox.netbox.nb_lookup', 'prefixes',
api_filter=oob_prefix_filter,
api_endpoint=netbox_url,
token=netbox_token)
}}" |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all. Is it possible to add in nb_lookup query multiple variables for api_filter.
For example, I want to get info about interface on device, api_filter must be looks like this:
"{{ query('netbox.netbox.nb_lookup', 'devices',
api_endpoint='http://localhost/',
api_filter='device' ~ switch 'name' ~ iface,
token='') }}"
switch and iface are vars, which i'm using in my playbook. But this syntax and any other doesn't work. Can someone explain me, is it possible to use multiple vars in one api request or not? Tnx
Beta Was this translation helpful? Give feedback.
All reactions