How do I use a variable with in a variable? I have one variable that outputs 4000
or the MOID of a VM guest ethernet adapter. How do I use that within another variable.
This variable, dtest43_nic.value[0].nic
gives me the MOID of the guest VM's ethernet adapter, which is 4000
. Then using that in another variable gives me the mac address, so test43_details.value.nics['4000'].mac_address
However, 4000
is not going to be the same for each VM guest. How do I make thetest43_details.value.nics['4000'].mac_address
variable more dynamic?
Trying "{{ dtest43_details.value.nics['dtest43_nic.value[0].nic'].mac_address }}"
doesn't work. I've tried the vars lookup but haven't been successful with that.
"{{ dtest43_details.value.nics[dtest43_nic.value[0].nic].mac_address }}"
work for you? - U880Ddoesn't work....
,haven't been successful...
are not accurate descriptions of the problem you are facing. You also probably want to read how to create a minimal complete and verifiable example and edit your question (at the very least with an example of your data structures, exact code you have written and example run of your ad-hoc commands or playbook). - Zeitounator