title: Ansible hostvars and template
body: <p>I have haproxy role , variables defined under vars/main.yml
  and template defined under template/haproxy.cfg.j2</p>
  <p>in main.yml var file I defined this variable :
  iface: ansible_default_ipv4.interface</p>
  <p>in the template file:</p>
  <pre><code>backend app
  balance     roundrobin
  {% for host in groups['web'] %}
      server {{ host }} {{ hostvars[host]['ansible_'+ iface ]['ipv4']['address'] }}:80 check
  {% endfor %}
  </code></pre>
  <p>The problem is when I execute the playbook I get the following error :
  changed&quot;: false, &quot;msg&quot;: &quot;AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute u'ansible_ansible_default_ipv4.interface'</p>
  <p>So as I know I have problem in the concatenation ['ansible_'+iface].</p>
  <p>Please your help.</p>