sequential task considered to be called in handlers #273
Replies: 3 comments
-
Or you can add I accept that that might not cover all use cases. I like the idea of being able to skip a specific rule though. Just needs someone to implement it. |
Beta Was this translation helpful? Give feedback.
-
This is pretty important I think as ANSIBLE0016 is not a very useful rule in the present way handlers are implemented in ansible. In fact I'd say, at least for now, ANSIBLE0016 (make tasks with when: changed handlers ) is actually not best practice and would more likely cause issues for people. For example ... you can't conditionally trigger the handlers right now so they always fire. It's also all or nothing when you trigger them. There's multiple situations when there's a bunch of stuff that needs to be set up before, for example, services are restarted and even in the safe case having lots of flush_handlers can make a playbook run take a lot longer and might have service affecting and odd behaviour as a result. Until handler triggering is far more fine grained I really do think this is not a sensible rule. |
Beta Was this translation helpful? Give feedback.
-
ANSIBLE0016 creates confusing code and I doubt it's "best practice". If I want a task to run after some other tasks changed something, "best practice" would be for the second task to be near the first one so code is easier to read and reason about. Flushing the handlers is not a good option. What if I already have other handlers waiting to execute but I actually want them to run last (like Ansible handlers are supposed to run by default)? |
Beta Was this translation helpful? Give feedback.
-
Issue Type
Ansible and Ansible Lint details
Desired Behaviour
When task need to be executed sequentially (they depend on the result of the previous task), we should be able to ignore a specific warning ("task should probably be a handler" in this case).
Actual Behaviour
If we want to remove the warning, we need to remove everything from that task:
Beta Was this translation helpful? Give feedback.
All reactions