We have ansible installed on all our production machines so we can do -c local deploys. I don’t want to upgrade those machines off of a “stable” version – if we’ve gotten far enough to run a -c local, at least some of the keys have been installed and we can skip the step.
So I figured I’d just gate the task on ansible_version or some such. However, there doesn’t appear to be such a variable, and I can’t find anything like that in -m setup.
Is there some way of figuring out if we’re running 1.5 or 1.6 or later and using that in a task?
Alternatively, is there a way of making my task work on 1.5? It worked on 1.2 and 1.3 (with a different path).
The actual crash is not my concern. There are several different ways that you can crash ansible on skipped roles. Another way to do it is via
with_sequence: start=1 end={{ numFoo }}
where numFoo is 0. That obviously should be an error when the task is run. What is surprising that ansible still crashes with “can’t count backwards” even if you tell it to skip the role containing the task:
{ role: ‘foo’, when: ‘numFoo > 0’ }
This can be worked around through judicious use of the default filter. It’s just annoying. My original email in this thread outlined a situation where I couldn’t find a workaround, and asks for one. I can run ansible 1.6 locally, but I need my playbook to be compatible with 1.5. It’s OK if it skips problematic plays.
It's entirely because you send an email reporting a crash
The actual crash is not my concern.
Should have probably indicated that in the first email
There are several different ways that you can crash ansible on skipped
roles. Another way to do it is via
with_sequence: start=1 end={{ numFoo }}
where numFoo is 0. That obviously should be an error when the task is
run. What is surprising that ansible still crashes with "can't count
backwards" even if you tell it to skip the role containing the task:
Conditionals are applied per loop step, not before the loop is evaluated.