Hello Nathanaël,
On 11/14/18 7:58 PM, Nathanaël Blanchet wrote:
I try to get a list for all vms :
"vm_name : description : id "
A simple loop works:
- debug:
msg: "{{ ovirt_vms | map(attribute='snapshots') | list }}"
register: snapshotid2
tags: snapshots2
- debug:
msg: "{{ ovirt_vms | map(attribute='name') | list }}"
register: name2
tags: snapshots2
- set_fact:
toto: "{{ name2.msg[item] }} : {{
snapshotid2.msg[0][0].description }} : {{ snapshotid2.msg[0][0].id }} "
with_item:
- 0
- 1
register: all_snapshots2
tags: snapshots2
- debug:
var: all_snapshots2
tags: snapshots2
Now I want insert a second loop with "with_nested" like so:
- set_fact:
toto: "{{ name2.msg[item.1] }} : {{
snapshotid2.msg[0].item.0.description }} : {{
snapshotid2.msg[0].item.0.id }} "
with_nested:
- [ '0', '1']
- [ '1', '0']
but I always have this error: "The error was: 'list object' has no
attribute u'0'"
How can I do such a thing?
if I got it right the loop should look like this:
- set_fact:
toto: "{{ name2.msg[item.1] }} : {{
snapshotid2.msg[0][item.0].description }} : {{
snapshotid2.msg[0][item.0].id }} "
with_nested:
- [ 0, 1 ]
- [ 1, 0 ]
Best regards,
Lucie
--
Lucie Leistnerova
Quality Engineer, QE Cloud, RHVM
Red Hat EMEA
IRC: lleistne @ #rhev-qe