I really like the ansible module interface: pure functions are powerful, super simple and really great. The with_items syntax adds a lot of power on top with very low cognitive overhead that helps keep you laser focused on describing your objectives in ways that tend to be very declarative.
Sometimes though, I’ve got a task that I need to do multiple times but can’t express as a single module call – or I might find myself needing to do something somewhat tricky in multiple different places and I’d like to avoid repeating the complexity. I use the the roles/ system heavily to try and reduce repetition, however some things just aren’t easily refactored into roles or its very awkward to do so and increases the cognitive overhead of understanding the overall objective.
Does a mechanism exist which makes it possible to basically package up a sequence of tasks as a module?
It would be (really really) cool if I could package up a sequence of tasks as a custom module. I imagine a syntax like this:
inside library/copyAndDecrypt.yml