registered variables not updating when using parametrized roles multiple times

Hi,

See 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

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.

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