registered variables not updating when using parametrized roles multiple times

32 views
Skip to first unread message

remcov...@noxqslabs.nl

unread,
Jun 20, 2014, 6:34:01 AM6/20/14
to ansible...@googlegroups.com
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

Michael DeHaan

unread,
Jun 20, 2014, 4:59:19 PM6/20/14
to ansible...@googlegroups.com
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.



--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b4c4d0d3-5f7c-4b5e-8034-5a8f1572736f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

remcov...@noxqslabs.nl

unread,
Jun 25, 2014, 9:42:01 AM6/25/14
to ansible...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages