Thanks for the reply Matt but debugging with that option lends:

TASK [output] 
*********************************************************************************************************************************************************************

fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'dict object' has no attribute 
'APIImplementationInfo'\n\nThe error appears to have been in 
'/Users/tony/foo2.yml': line 40, column 5, but may\nbe elsewhere in the 
file depending on the exact syntax problem.\n\nThe offending line appears 
to be:\n\n\n  - name: output\n    ^ here\n"}

On Tuesday, January 29, 2019 at 8:52:22 AM UTC-6, Matt Martz wrote:
>
> Probably something such as:
>
> - debug:
>     msg: "{{ 
> apis.json.APIImplementationInfo|selectattr('AnonymousAccessAllowed')|list 
> }}"
>
> On Tue, Jan 29, 2019 at 7:50 AM cortado <[email protected] <javascript:>> 
> wrote:
>
>> If anyone has a suggestion I'd appreciate it.  This is driving me bonkers 
>> and i'm sure I am missing some basic understanding.
>>
>> Thanks
>>
>> On Saturday, January 26, 2019 at 10:04:13 AM UTC-6, cortado wrote:
>>>
>>>
>>>
>>> I'm trying to parse the output of a uri request that I have saved in a 
>>> variable named "apis".  Ultimately i will want to match several items when 
>>> AnonymousAccessAllowed=true but I'm not having success.  Any help would be 
>>> appreciated.
>>>
>>> If i debug "{{apis.json}}" this is the output.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> TASK [debut apis] 
>>> **********************************************************************************************************************************
>>>
>>> ok: [localhost] => {
>>>
>>>     "msg": {
>>>
>>>         "APIImplementationInfo": [
>>>
>>>             {
>>>
>>>                 "APIOwnedImplementation": true,
>>>
>>>                 "APIVersionID": 
>>> "799285b2-ac87-44be-8f61-342b96ffba2c.travelportAPI",
>>>
>>>                 "AnonymousAccessAllowed": false,
>>>
>>>                 "EndpointAccessAutoApproved": true,
>>>
>>>                 "ImplementationCode": "Live",
>>>
>>>                 "Pattern": "com.akana.pattern.proxy",
>>>
>>>                 "ServiceKey": 
>>> "uddi:5988b66a-ff7f-11e6-8674-d0288b15863d"
>>>
>>>             },
>>>
>>>             {
>>>
>>>                 "APIOwnedImplementation": true,
>>>
>>>                 "APIVersionID": 
>>> "799285b2-ac87-44be-8f61-342b96ffba2c.travelportAPI",
>>>
>>>                 "AnonymousAccessAllowed": true,
>>>
>>>                 "EndpointAccessAutoApproved": true,
>>>
>>>                 "ImplementationCode": "Sandbox",
>>>
>>>                 "Pattern": "com.akana.pattern.proxy",
>>>
>>>                 "ServiceKey": 
>>> "uddi:3ebe224d-506b-11e7-ba06-98021d1b1c3f"
>>>
>>>             }
>>>
>>>         ]
>>>
>>>     }
>>>
>>> }
>>>
>>> This is the relevant parts of the playbook.  I've commented out the when 
>>> condition but get an undefined variable in the test task.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   - name: debut apis
>>>
>>>     debug:
>>>
>>>       msg: "{{apis.json}}"
>>>
>>>
>>>
>>>   - name: init fact
>>>
>>>     set_fact:
>>>
>>>       anon: "[]"
>>>
>>>
>>>
>>>   - name: test
>>>
>>>     set_fact:
>>>
>>>       anon: “{{anon}} + [ {{item.AnonymousAccessAllowed}} ]"
>>>
>>>     #when: item.AnonymousAccessAllowed | search(“true”)
>>>
>>>     with_items: “{{apis.json.APIImplementationInfo}}”
>>>
>>>
>>>
>>>   - name: output
>>>
>>>     debug:
>>>
>>>       msg: “{{anon}}”
>>>
>>>
>>>
>>>
>>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/49e324c4-099f-4656-bce9-12f33abe349d%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/49e324c4-099f-4656-bce9-12f33abe349d%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
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/4317a482-56f6-465a-a2d5-92c3a5e2eab9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to