The section about roles in the 'Ansible: Up and Running' book covers this
topic quite well.
The recommendation in the book is to always prefix var names inside the
role with the name of the role, which I believe is for the exact reason of
avoiding the scenario that you ran into.
On Friday,
I managed to at least get around the error:
The trick is to use "internal" variables inside the role which never get
set outside the role. So if I have 2 "external" vars where the role wiill
set some 3rd variable depending on those two, the trick is to not re-use
the name of one of the two
Jon (et al), I've created this playbook to distill my problem, available
here:
https://drive.google.com/file/d/0B81YECbGAyfWaW5rbVRQNlpQT2c/view?usp=sharing
Same thing happens: Then the (previously undefined) variable "variable3"
gets set using set_fact within a role, subsequent calls to that
Thanks Jon, I'll distill it a bit and see what I come up with.
On Thursday, June 16, 2016 at 9:45:43 AM UTC+2, J Hawkesworth wrote:
>
> That is very unexpected.
>
> I pass vars to the same role a lot, although in my case I am usually doing
> it within the same play (as opposed to within a
That is very unexpected.
I pass vars to the same role a lot, although in my case I am usually doing
it within the same play (as opposed to within a different play inside the
same playbook), and I almost always pass the vars in as -e (extra vars),
which from memory have highest precedence.
>From what I can see, once a previously undefined variable has been set by a
role, the calling playbook is unable to override it on subsequent calls.
On Wednesday, June 15, 2016 at 8:29:17 PM UTC+2, Trond Hindenes wrote:
>
> Hi,
> I have this weird situation where a role doesn't pick up