# registered variables not updating when using parametrized roles multiple times

**URL:** <https://forum.ansible.com/t/registered-variables-not-updating-when-using-parametrized-roles-multiple-times/15513>\
**Category:** Ansible Project\
**Created:** [June 20, 2014, 10:34am UTC](https://forum.ansible.com/t/registered-variables-not-updating-when-using-parametrized-roles-multiple-times/15513 "2014-06-20T10:34:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![remcovanhest](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@remcovanhest](https://forum.ansible.com/u/remcovanhest)\
**Post date:** [June 20, 2014, 10:34am UTC](https://forum.ansible.com/t/registered-variables-not-updating-when-using-parametrized-roles-multiple-times/15513/1 "2014-06-20T10:34:01Z")

</div>

Hi,

See [https://github.com/ansible/ansible/pull/7838](https://github.com/ansible/ansible/pull/7838) for a description of the problem.  
Unfortunately the solution proposed in the pull request was rejected.  
Does anyone know a way to get this to work?

Thanks.

- Remco

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [June 20, 2014, 8:59pm UTC](https://forum.ansible.com/t/registered-variables-not-updating-when-using-parametrized-roles-multiple-times/15513/2 "2014-06-20T20:59:16Z")

</div>

We are not interested in entertaining this feature because it takes playbooks into what I’d consider a sketchy programming territory.

For instance, Perl allowed $$x to mean “the value of the variable with the name of the value of x”.

This is a slippery slope we wish to avoid.

Can we step back and try to understand what the use case of the IT solution you are trying to model is? Then another solution may jump out.

---

<div class="post-metadata">

**Author:** ![remcovanhest](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@remcovanhest](https://forum.ansible.com/u/remcovanhest)\
**Post date:** [June 25, 2014, 1:42pm UTC](https://forum.ansible.com/t/registered-variables-not-updating-when-using-parametrized-roles-multiple-times/15513/3 "2014-06-25T13:42:01Z")

</div>

Sorry for such a late response, weekend got in the way of things.

I wasn’t looking for another way to get the pull request in, but as you suggested a different solution.

However, after digging around my playbook I managed to find the mistake I made, I think.  
In my site.yml I only have include statements, and in the .yml’s that get included I have specific var\_files: blocks for those roles.  
1 file however was in multiple var\_files: blocks and apparently this was messing up register: for variables  
in my setup\_user role which gets called multiple times for different users. It wouldn’t update the variables with new output from a command:

After ensuring every variable file is only included once through var\_files things started working again.

I apologize for wasting everyone’s time.

- Remco
