Hi,

The version of Ansible we are using does not support selectattr to filter a 
list based on attribute names. So I instead use something like this:

set_fact:
  thing: '{{ (things | json_query("[?thing_name==''" + a_thing_name + "'']") | 
list)[0]  }}'


Is there a cleaner way to do this? Without using double single-quotes for 
escaping and + for concatenation?

-- 
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/3cabb022-58ff-4865-8144-c76be30470b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to