You can move the actual query string to a separate variable to reduce some
clutter and string concatenation. You can also use ` (backticks) to quote
jmes_path strings:
set_fact:
enabled_ports: "{{ intfs | json_query(enabled)}}"
vars:
enabled: "values(@)[?is_enabled && is_up && vlan_tag == `{{
mgmt_vlan }}`]"
kind regards
Pshem
On Mon, 30 Oct 2017 at 13:55 Behrang Saeedzadeh <[email protected]> wrote:
> Is there a cleaner alternative to:
>
> '{{ (things | json_query("[?name==''" + thing_name + "'']") }}'
>
> In particular, ideally I want to avoid:
>
> - String concatenation
> - Escaping of quotes
>
> --
> 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/e6e3df70-21f1-4fee-99da-b18de36727b2%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/e6e3df70-21f1-4fee-99da-b18de36727b2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CAEaZiRV1dSeQ7YYfsXZu1Rjf%3DFagaqYuL2hHQgMFNgswaMg1Gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.