The serial: 1 allows us to run a play sequentially for each host in the host group. But we cannot find similar setting at task level. We want to find a way to run a task in a role sequentially for each host because some external racing issue. Anyone knows how to do it?
I too sometimes wished this could be triggered at task level, so it can
be defined at role level.
One of my use cased would then be to use it in a handler (which is just a
special task) to avoid race conditions when run on the same delegated host.
So, rather than serial: 1 at a task level (this is a bit of a complex thing), what I really want is the equivalent of the BYPASS_HOST_LOOP code that the pause module uses to be used at a language level also.
Basically thus:
module_foo: blah
local_action_once: module blah
module_baz: blah
I don’t think it would make much sense out of a local action.
In the other case, I do believe it should be a seperate play to reuse the existing functionality and make it more explicit.
We separated the play, and use serial: 1 for the task which we want to run at one host per time. But we observed that if first node at this task fails, then all the other nodes will not be ran anymore. and also it only reports the failure for the first node, for all other nodes, even though the task is not performed, ansible still reports succeeded.