I'm trying to do the following:
* From an object that stores multiple EC2 instance ids
* Use those values to iterate over a second json object using each 
individual instance id as a filter

I've tried to do this with json_query with multiple approaches, including 
the following:

>  

> - name: Terminate instances with tag Role = {{ ec2_tag_Role }}
>   ec2:
>     region: "{{ ec2_region }}"
>     instance_ids: "{{ ec2_id }}"
>     state: 'absent'
>     wait: true
>   delegate_to: "localhost"
>   register: ec2
>
 

> - name: Get node information from Shippable
>   uri:
>     url: https://api.shippable.com/clusterNodes
>     method: GET
>     headers:
>       authorization: "apiToken {{ API_TOKEN }}"
>       cache-control: "no-cache"
>       content-type: "application/json"
>   register: shippable
>
 

> - name: Get clusterNodeIds for Shippable nodes
>   debug: var=item
>   vars:
>     query: "\"json[?friendlyName=='\" + item[0] + \"'].{id: node}\""
>   with_nested:
>     - "{{ ec2.instances.id }}"
>     - "{{ shippable|json_query(query) }}"
>   register: shippableClusterIds


The above attempt doesn't work, as the vars: query statement is scoped 
once, not on each iteration of the nested loop. Is there any way to use the 
the values from the first item in the nested items inside the json_query 
statement? I don't need to use json_query if there's another way to 
accomplish this.


-- 
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/806dd7bd-a484-48e9-9dca-499d4b6f1dc4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to