Last active
January 15, 2016 17:49
-
-
Save evenme/15dd0005fce6fa8d57e5 to your computer and use it in GitHub Desktop.
Ansible - creating and using variables names from other variables
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
--- | |
hosts: all | |
vars: | |
env: "myvar" | |
env_path: "/data/my/path/to/file/" | |
tasks: | |
- set_fact: "{{ env + '_path' }}={{ env_path }}" | |
- debug: msg="{{ vars[env + '_path'] }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment