I have a dictionary structure that looks like the following:
myservers:
DC1:
CORE: 10.10.10.20
DMZ: 10.10.20.20
DC2:
CORE: 10.10.10.30.20
DMZ: 10.10.10.40.20
DC3:
CORE: 10.10.50.20
DMZ: 10.10.60.20
DC4:
CORE: 10.10.70.20
DMZ: 10.10.80.20
And another dictionary that looks like the following:
location:
address: 10.10.10.10
dc: DC1
net: 10.10.10.0
bits: 24
zone: CORE
I want to do something like the following:
- debug:
msg: "myserver = myservers['{{location.dc}}']['{{location.zone}}']"
and get back the message:
myserver = 10.10.10.20
But instead, I get:
myserver = myservers['DC1']['CORE']
I want to see the value stored at myservers['DC1']['CORE'], not the
string "myservers['DC1']['CORE']".
I have tried " {{ myservers['{{location.dc}}']['{{location.zone}}] }}",
but YAML does not allow nested braces, so that fails. And I have tried
many other variations, but they all fail too. I am stymied. How do I
extract the information I want?
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/0cb211b9-7c67-4b5a-b04b-2cd66db2fd24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.