First, the thirsty parameter stopped working with the copy module. I think I saw somewhere else that this had been changed to force, so I updated it.
Second, and more importantly, the following stopped working:
Ok, so 1.0 has been out for a long time and haven't heard any errors
about these things. To me it sounds like you may not have
$ANSIBLE_PATH defined in scope somewhere. Where did you have it set?
(I don't think we ever released 'thirsty' for the copy module, it was
force prior to release in 1.0-devel IIRC. I could be wrong. In any
event, thirsty was a terrible name, and those responsible have been
sacked!)
OK I’ve found the bug.
There’s no issue with copy, but there is with include. If the group_vars/all file is specifically included in the vars_files: section, the parametrized-path in the include works, otherwise it does not. The behavior should be the same.
To show/hide the problem, uncomment the vars_files section in the test below.
Wait Michael, I’m trying to grasp this, so please bear with me.
Ohhhhh - I think I got it. You’re saying the notion of inventory (groups_vars/ host_vars) is distinct from the notion of vars/vars_files?Just double confirming so I don’t miss anything in my understanding; I was (naively) mixing them up so far - I will henceforth place all vars files under the separate vars folder - and emphasize this in our internal best-practices.
Wow, this works? What are the restrictions on “ansible_distribution”? can it be an inventory variable (I assume not) ?
And you’re saying this is semantically equivalent to all actions in the included file having the “when_string” …
Holy moly … this is damn powerful.
group_vars/host_vars are inventory specific variables that vary by
host and group.
Variables loaded by vars_files CAN hinge on inventory and group
variables, and often do, but include paths may not hinge on such
things.
In general, usage of vars_files is almost always replaced by keeping
variables in group_vars/host_vars, but not always, and you are welcome
to use both depending on the use case.
It is fact true that you can use facts as well as inventory variables
in conditionals, without restriction, and it does work on only_if as
well.
Note that this "affix the conditionals to the include" only works on
task includes, not playbook includes.
OK good.
My sincere counsel is to enhance the documentation on include to mention both of these restrictions:
include paths can only be derived from vars/vars_files but NOT inventory variables
task (but not playbook) includes can be used with conditionals, and are equivalent to putting the conditional on each included action
(I assume: this works like an AND on existing conditionals; this is recursive to arbitrary include depths)
Again, this is superbly powerful, I will utilize this immediately and simplify the implementation of a lot of use-cases.