Re: [ansible-project] Is there a cleaner alternative to '{{ (things | json_query("[?name==''" + thing_name + "'']") }}'

2017-10-30 Thread Behrang Saeedzadeh
Perfect! Thanks.

On Monday, October 30, 2017 at 1:00:41 PM UTC+11, Pshem Kowalczyk wrote:
>
> 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  > 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 ansible-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/e6e3df70-21f1-4fee-99da-b18de36727b2%40googlegroups.com
>>  
>> 
>> .
>> 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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/184f2f49-a10f-4f17-ad08-201fd5418d9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Is there a cleaner alternative to '{{ (things | json_query("[?name==''" + thing_name + "'']") }}'

2017-10-29 Thread Pshem Kowalczyk
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  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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/e6e3df70-21f1-4fee-99da-b18de36727b2%40googlegroups.com
> 
> .
> 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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
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.


[ansible-project] Is there a cleaner alternative to '{{ (things | json_query("[?name==''" + thing_name + "'']") }}'

2017-10-29 Thread Behrang Saeedzadeh
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e6e3df70-21f1-4fee-99da-b18de36727b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.