Skip to content

Instantly share code, notes, and snippets.

@evenme
Last active January 15, 2016 17:49
Show Gist options
  • Save evenme/15dd0005fce6fa8d57e5 to your computer and use it in GitHub Desktop.
Save evenme/15dd0005fce6fa8d57e5 to your computer and use it in GitHub Desktop.
Ansible - creating and using variables names from other variables
---
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