# variable within a variable in template

**URL:** <https://forum.ansible.com/t/variable-within-a-variable-in-template/25132>\
**Category:** Ansible Developer\
**Created:** [July 31, 2017, 1:30am UTC](https://forum.ansible.com/t/variable-within-a-variable-in-template/25132 "2017-07-31T01:30:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![madhan0618](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@madhan0618](https://forum.ansible.com/u/madhan0618)\
**Post date:** [July 31, 2017, 1:30am UTC](https://forum.ansible.com/t/variable-within-a-variable-in-template/25132/1 "2017-07-31T01:30:06Z")

</div>

I am trying to push a property file template like the below

schema.registry.url=http://{{ schemaregis\_host{{ play\_hosts.index(inventory\_hostname) }} }}:8081

I pass extra variables like these in the ansible input command

schemaregis0=host1 schemaregis1=host2

[inventory-hosts]  
server1  
server2

i want server1 property file to have the schemaregis0=host1 and server2 to have the other

ansible doesnt like the variable within a variable. how can i get around this?
