Created
March 11, 2020 10:52
-
-
Save zeitounator/6f5d02c1539b1edd0002d2e20c00113d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat test.yaml | |
--- | |
- hosts: localhost | |
gather_facts: false | |
vars: | |
cache_mgmt: | |
dev_web: | |
backend_name: www_http_be | |
backend_hosts: dev_www | |
dit_web: | |
backend_name: www_http_be | |
backend_hosts: dit_www | |
tasks: | |
- set_fact: | |
backend_name: "{{ cache_mgmt[configs_target].backend_name }}" | |
- debug: | |
var: backend_name | |
$ ansible-playbook test.yaml -e '{"configs_target":"dev_web"}' | |
PLAY [localhost] ************************************************************************************************************************************************************************************************** | |
TASK [set_fact] *************************************************************************************************************************************************************************************************** | |
ok: [localhost] | |
TASK [debug] ****************************************************************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"backend_name": "www_http_be" | |
} | |
PLAY RECAP ******************************************************************************************************************************************************************************************************** | |
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment