V
V
vitkuz5732021-09-08 07:40:42
Ansible
vitkuz573, 2021-09-08 07:40:42

How to use a variable as an Ansible dictionary key?

There is a dictionary like this:

name_group: "TEST"
group: "1"

vms:
  VM-"{{ name_group }}"-"{{ group }}":
    source: "VM1"
    folder: "/test"


But this way the variables are not recognized as variables but as text. How can this issue be resolved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2021-09-08
@opium

So you probably need a yaml?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question