Answer the question
In order to leave comments, you need to log in
How to create a variable name in ansible which will contain one more variable?
There is a variable "{{ some_staff1 }}".
I want to make a loop that will write:
var: "{{ some_staff1 }}"
The whole problem is to make it so that the index at the end of the variable is also a variable:
var: "{{ some_staff{{ item.index }} } }"
with_items:
- { index: 1}
- { index: 2}
What I described above is not a working construct
. But I hope the essence of what I want to achieve is clear.
It is necessary that there is one more variable inside the variable name. Perhaps it will be possible to solve the issue using jinja2.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question