Here is the solution: - name: Extract ID from Nested List set_fact: id: "{{ id[0][0] }}"
On Tuesday, June 22, 2021 at 2:41:49 PM UTC-4 Mike Cifelli wrote: > Seeking assistance with properly parsing returned json data, storing > desired string as variable, to then append it in another play that updates > a resource. Essentially I am interacting with Cisco ISE APIs to > manage/update endpoint attributes. Overview of playbook: > > -The first play is a GET query to provide me with a specific endpoint > details > > -The next play prints the returned output essentially showing the admin > that everything is good thus far > > -Then I extract the endpoint ID string using json_query and store it as a > variable > > -For peace of mind the following play prints the variable to show we have > the ID string of the endpoint > > -Then the last play I attempt to update the endpoint group assignment via > appending the id string > > I am stuck on the last play that appends the endpoint id string. Play > using json_query: > > - name: Get ISE ID String > > set_fact: > > id: "{{ endpoint_id | json_query(jmesquery) }}" > > vars: > > jmesquery: '*.SearchResult.resources[*].id' > > Tower output showing how the id string is being appended: > > "status": 400, "url": " > https://xx.xx.xx.xx:9060/ers/config/endpoint/[[u'69d3bf30-ce12-11eb-ba90-c63c5470e9ab']] > " > > How can I properly store/append the endpoint id string properly so that > the url in my last play looks like this: > > "status": 400, "url": " > https://xx.xx.xx.xx:9060/ers/config/endpoint/69d3bf30-ce12-11eb-ba90-c63c5470e9ab > " > > Please advise. TIA! > -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/96867314-798f-4efd-bc90-8d2e66255f90n%40googlegroups.com.