Problem with variables variables

24 views
Skip to first unread message

Josu Vilda

unread,
Nov 20, 2017, 10:11:15 AM11/20/17
to Ansible Project
Hi,

I have a problem with variables.

this is correct:
.....
 
- debug:
        msg
: "{{ vm_list.virtual_machines.SRV1.uuid }}"
....



but, i need:

.....
       
register: vmname
 
- debug:
        msg
: "{{ vm_list.virtual_machines.{{ vmname }}.uuid }}"

....

how do i have to do it?

thx

Pshem Kowalczyk

unread,
Nov 21, 2017, 2:32:58 AM11/21/17
to ansible...@googlegroups.com
Hi,

Try this:

{{ vm_list.virtual_machines[vmname].uuid }}

kind regards
Pshem


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9b587921-51c1-42c0-8684-cb3fed56f454%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Josu Vilda

unread,
Nov 21, 2017, 3:34:42 AM11/21/17
to Ansible Project

Sincerely thanks.

Reply all
Reply to author
Forward
0 new messages