My requirements are these: a deployment environment is passed into the playbook as extra vars, for ex : dev, qa or prod
I have a variable called DEPLOY_URL
Based on the value of the env variable, the DEPLOY_URL has to change.
I tried doing the following :
DEPLOY_URLS:
"dev": "xyz"
"prod" : "abc"
"qa" : "123"
DEPLOY_URL: "{{DEPLOY_URLS['{{DEPLOY_ENV}}']}}"
The value is never correct. Is there a way to access a dictionary using another variable as key? (Using YAML and ansible)
Try this: DEPLOY_URL: "{{ DEPLOY_URLS[DEPLOY_ENV] }}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With