title: ansible - variable within variable
body: <p>Ansible 1.9.2 version.</p>
  
  <p>Does Ansible supports variable expansion within a variable while evaluating it.</p>
  
  <p>I have a task to download 3 zip files from Artifactory.</p>
  
  <p>Instead of writing 3 separate tasks within the role, I used ansible's loop in the playbook. In Ansible role's default/main.yml, I have all the required variables defined/available to the role i.e. jmeterplugins_extras_artifactory_url and other (standard / webdriver) are visible to <strong><em>perf_tests</em></strong> role.  </p>
  
  <pre><code>---
  #- Download and install JMeterPlugins
  # Use get_url when Ansible is 2.0+ is available on the machine (otherwise, we can't use get_url) thus, using wget.
  - name: Download JMeterPlugins-*
    command: wget {{ jmeterplugins_{{ item.plugin }}_artifactory_url }}  
      chdir="{{ common_download_dir }}"
      creates="{{ common_download_dir }}/{{ jmeterplugins_{{ item.plugin }}_file }}"
    with_items:
      - { plugin: 'extras' }
      - { plugin: 'standard' }  
      - { plugin: 'webdriver' }   
  </code></pre>
  
  <p>But with the above code, I'm getting an error (as shown below):</p>
  
  <pre><code>15:58:57 TASK: [perf_tests | Download JMeterPlugins-*] ********************************* 
  15:58:57 &lt;jmeter01.super.fast.jenkins&gt; ESTABLISH CONNECTION FOR USER: cmuser on PORT 22 TO jmeter01.super.fast.jenkins
  15:58:57 fatal: [jmeter01.super.fast.jenkins] =&gt; Failed to template wget {{ jmeterplugins_{{ item.plugin }}_artifactory_url }} chdir="{{ common_download_dir }}" creates="{{ common_download_dir }}/{{ jmeterplugins_{{ item.plugin }}_file }}": template error while templating string: expected token 'variable_end', got '{'
  15:58:57 
  15:58:57 FATAL: all hosts have already failed -- aborting
  15:58:57 
  15:58:57 PLAY RECAP ******************************************************************** 
  15:58:57            to retry, use: --limit @/home/cmuser/perf_tests.retry
  15:58:57 
  15:58:57 jmeter01.super.fast.jenkins : ok=23   changed=6    unreachable=1    failed=0   
  </code></pre>
  
  <p>Doesn't ansible supports variable expansion/evaluation if a variable contains another variable (especially when I'm using a loop).</p>
  
  <p>I just dont want to expand my simple loop task into 3 different -name tasks for downloading zip files for jmeterplugins_extras, jmeterplugins_standard and jmeterplugins_webdriver separately. It seems like the error is related due to Jinja.</p>
  
  <p>How can I use var's value <strong>giga</strong> in another variable i.e. if <em>var</em> contains <strong>giga</strong>, then I should get the value of variable "special_giga_variable" (<em>{{special_{{ var }}_variable}}</em>)? where var was defined in defaults/main.yml as:</p>
  
  <p>var: giga</p>