vars.yml
---
volumes:
 "vol-1-{{env}}":
   size: 500
   fs: "ext3"

play.yml
- hosts: localhost
  connection: local
  gather_facts: no
  vars_files:
   - vars.yml
  tasks:
  - set_fact:
     volume_name: "vol-1-{{env}}"
  - debug: msg='{{ volumes[volume_name].size }}'

ansible-playbook test.yml -e "env=dev1"

 I would expect the above play to output 500, but it fails instead with the 
below error. Is this the expected behaviour for a dict with variables in 
the key field? 

* The error was: 'dict object' has no attribute u'vol-1-fut1'*


-- 
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/c3bd2026-7088-4621-94ec-1c626abc9dc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to