I have a variable file that includes a list like below format:
VAR:
- a: 1
b: 2
c: 3
- a: 4
b: 5
c: 6
Here, I want to add another variable referencing a sub variable within a list, for example:
VAR:
- a: 1
b: 2
c: 3
d: "{{ VAR.0.a }}"
- a: 4
b: 5
c: 6
d: "{{ VAR.1.a }}"
But they didn't work.
I tried {{ VAR[0].a }} {{ VAR[a] }} {{ VAR.0.a }} and etc, but none of them worked.
How do you refer to a sub element within a list?