as in ansible, add variables to the file like this:

var:

var1:

  • dynamic variable 1
  • dynamic variable 2

I tried blockinfile and linefile, but the structure doesn’t work out in any way, are there any examples of how to do this as above.? thanks in advance!

I did it, I did it through block in file, but only here is the problem, if I want to add var2 and so on, then var2 with its values ​​overwrites var1, how to fix it?

  • Can you give more details? Does this mean that there are several variables and need to be written in a nested form? - UserName

0