Change your `json_query` var to use backticks (``) instead of quotes ('')
around the 0
- vars:
json_query: "[?lun==`0`]"
On Wed, Feb 13, 2019 at 11:34 AM Justin DynamicD <[email protected]>
wrote:
> Ill let a fast sample bit of code do the talking:
>
>
> ---
> - name: query test
> hosts: "localhost"
> gather_facts: no
> tasks:
> - set_fact:
> drives:
> - lun: 0
> size: "25gb"
> - lun: 1
> size: "100gb"
>
> - vars:
> json_query: "[?lun=='0']"
> set_fact:
> output: "{{ drives | json_query(json_query) }}"
>
> - debug:
> var: output
>
>
>
> So in the above example, output = [], because json_query looks for a
> string and not an integer. If I were to change the dictionary to use only
> strings I'd have no issues.
>
> So ... does anyone know how to use json_query against integers?
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/cfdf4b9a-bf0b-43fc-acfd-1ac94c9cfe05%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/cfdf4b9a-bf0b-43fc-acfd-1ac94c9cfe05%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Matt Martz
@sivel
sivel.net
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAD8N0v8tMSCUPdiOGX7OYoo6MFMVnm0hRHoWhKcktB3RCn4%2BUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.