Here ya go (I pulled out a bunch of output that just muddied up everything:

    "msg": [
        [
            {
                "date": "2021-04-10 00:19:25.785000+00:00",
                "description": "Active VM",
                "href": 
"/ovirt-engine/api/vms/e0abbe35-3c4c-463b-8d08-587618d2465d/snapshots/22e82416-71b4-4808-b315-4cf7d713ae31",
                "id": "22e82416-71b4-4808-b315-4cf7d713ae31",
                "persist_memorystate": false,
                "snapshot_status": "ok",
                "snapshot_type": "active"
            },
            {
                "cdroms": [],
                "date": "2023-02-22 09:02:48.843000+00:00",
                "description": "Snapshot of VM1 2023-02-22",
                "disks": [],
/* Redacted extra output */
            },
            {
                "cdroms": [],
                "date": "2023-02-23 09:03:23.519000+00:00",
                "description": "Snapshot of VM1 2023-02-23",
                "disks": [],
/* Redacted extra output */
            }
        ]
    ]
}

Thanks,
Harry
On Thursday, February 23, 2023 at 3:40:39 PM UTC-5 Rowe, Walter P. (Fed) 
wrote:

> Can you share the output from this: 
>
>     - name: Show results
>       ansible.builtin.debug:
>         msg: "{{ item }}"
>
>       loop:
>         - "{{ result.results | json_query('[*].ovirt_snapshots') }}"
>
>
> I suspect at this point it is just a matter of constructing the right 
> reference in 'item'.
>
> Walter
> --
> Walter Rowe, Division Chief
> Infrastructure Services, OISM
> Mobile: 202.355.4123 <(202)%20355-4123>
>
> On Feb 23, 2023, at 3:35 PM, [email protected] <[email protected]> wrote:
>
> Still no good: 
>
> TASK [Show results] 
> ***********************************************************************************************************************************************************************************
> fatal: [localhost]: FAILED! => {"msg": "The task includes an option with 
> an undefined variable. The error was: 'description' is undefined. 
> 'description' is undefined\n\nThe error appears to be in 
> '/root/vm_snapshot_info.yml': line 48, column 7, but may\nbe elsewhere in 
> the file depending on the exact syntax problem.\n\nThe offending line 
> appears to be:\n\n\n    - name: Show results\n      ^ here\n"}
>
>     - name: Show results
>       ansible.builtin.debug:
>         msg: "{{ item,description }}"
>       loop:
>         - "{{ result.results | json_query('[*].ovirt_snapshots') }}"
>
> Thanks,
> Harry
> On Thursday, February 23, 2023 at 3:32:32 PM UTC-5 Rowe, Walter P. (Fed) 
> wrote:
>
>>     - name: Show results
>>       ansible.builtin.debug:
>>         msg: "{{ item.description }}"
>>
>>       loop:
>>         - "{{ result.results | json_query('[*].ovirt_snapshots') }}"
>>
>>
>> Walter
>> --
>> Walter Rowe, Division Chief
>> Infrastructure Services, OISM
>> Mobile: 202.355.4123 <(202)%20355-4123>
>>
>> On Feb 23, 2023, at 3:21 PM, [email protected] <[email protected]> wrote:
>>
>> So that gives me the data under each VM's ovirt_snapshots, but I still 
>> can't access the "description" data.  I tried this: 
>>
>>     - name: Show results
>>       ansible.builtin.debug:
>>         msg: "{{ item }}"
>>       with_nested:
>>       - "{{ item[0].description }}"
>>       loop:
>>         - "{{ result.results | json_query('[*].ovirt_snapshots') }}"
>>
>> And it shows me the same information with or without the "with_nested" 
>> clause in there.
>>
>> Thanks,
>> Harry
>> On Thursday, February 23, 2023 at 3:13:02 PM UTC-5 Rowe, Walter P. (Fed) 
>> wrote:
>>
>>> How about this?
>>>
>>>     - name: Show results
>>>       ansible.builtin.debug:
>>>         msg: "{{ item }}"
>>>       loop:
>>>         - "{{ result.results | json_query('[*].ovirt_snapshots') }}"
>>>
>>> Walter
>>> --
>>> Walter Rowe, Division Chief
>>> Infrastructure Services, OISM
>>> Mobile: 202.355.4123 <(202)%20355-4123>
>>>
>>> On Feb 23, 2023, at 2:59 PM, [email protected] <[email protected]> 
>>> wrote:
>>>
>>> That works, but it only shows the info for the first VM.  There are 22 
>>> total.  What I'd like to have is the VM name and list of all of that VMs 
>>> snapshots, so I need to be able to traverse through the output at the VM 
>>> level, then travers that VM's ovirt_snapshots data. 
>>>
>>> Thanks,
>>> Harry
>>>
>>> On Thursday, February 23, 2023 at 2:52:11 PM UTC-5 Rowe, Walter P. (Fed) 
>>> wrote:
>>>
>>>>     - name: Show results
>>>>       ansible.builtin.debug:
>>>>         msg: "{{ item }}"
>>>>       loop:
>>>>         - "{{ result.results[0].ovirt_snapshots }}"
>>>>
>>>> Walter
>>>> --
>>>> Walter Rowe, Division Chief
>>>> Infrastructure Services, OISM
>>>> Mobile: 202.355.4123 <(202)%20355-4123>
>>>>
>>>> On Feb 23, 2023, at 2:37 PM, [email protected] <[email protected]> 
>>>> wrote:
>>>>
>>>> Nope.  I get: "list object has no attribute 'ovirt_snapshots'. 
>>>>
>>>> Thanks,
>>>> Harry
>>>>
>>>> On Thursday, February 23, 2023 at 2:34:26 PM UTC-5 Rowe, Walter P. 
>>>> (Fed) wrote:
>>>>
>>>>>     - name: Show results
>>>>>       ansible.builtin.debug:
>>>>>         msg: "{{ item }}"
>>>>>       loop:
>>>>>         - "{{ result.results.ovirt_snapshots }}"
>>>>>
>>>>> How about this?
>>>>>
>>>>> Walter
>>>>>
>>>>>
>>>> -- 
>>>> 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 view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/ansible-project/b977149b-b0c9-4c62-9579-bec36f041f72n%40googlegroups.com
>>>>  
>>>> <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2Fb977149b-b0c9-4c62-9579-bec36f041f72n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C7770c9de12d74665e37708db15dd7b2c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638127813222403055%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=k%2FD0R%2FJ7fjelDNV78VqfR%2FqU518Zyngdj4JRv8L7y58%3D&reserved=0>
>>>> .
>>>>
>>>>
>>>>
>>> -- 
>>> 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/65bac0a6-5df8-43e9-bd16-1ce0f2cf9610n%40googlegroups.com
>>>  
>>> <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F65bac0a6-5df8-43e9-bd16-1ce0f2cf9610n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C7770c9de12d74665e37708db15dd7b2c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638127813222403055%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1bBjrpmWsf1ql%2FxhmZNEu%2BSxBCA%2FT5O9XKD1%2FwaOOXY%3D&reserved=0>
>>> .
>>>
>>>
>>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/5b077e4d-a84e-4d06-bee5-0d29509b06c2n%40googlegroups.com
>>  
>> <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F5b077e4d-a84e-4d06-bee5-0d29509b06c2n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C7770c9de12d74665e37708db15dd7b2c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638127813222559751%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=HlXzgL6gf2g5N%2BSH7BEiKbDIsEYril3fRciCU9NA7To%3D&reserved=0>
>> .
>>
>>
>>
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/beadb086-20cc-4f22-886e-8fdc33671844n%40googlegroups.com
>  
> <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2Fbeadb086-20cc-4f22-886e-8fdc33671844n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C7770c9de12d74665e37708db15dd7b2c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638127813222559751%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Kl9dYGz6A7S%2BrzXyiNZtU6spaK6dWFOqECV1H9M5tf8%3D&reserved=0>
> .
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/58e53988-de79-4d3d-ad3b-19b1b5f0ee40n%40googlegroups.com.

Reply via email to