I suspect this question comes up from time to time, but I'm struggling to wrap my brain around how we should organize our playbooks. We have a few different types of configuration:
- role - run on regular time intervals - configuration that describes a node.
- deployments - run on a as needed basis.
- adhoc - run on a as needed basis -- plays that are more complex than a simple ansible -m execution.
I get the role based configuration model and associated configuration layout. It's the easiest to grok and is similar to how other config systems manage groups of nodes. I have setup a pull workflow that determines a node's role and executes it's associated role playbook. We execute this randomly in 10 minute intervals, but we can also force an execution via the push model.
Ok, so that's all fine and well, but I don't know what the best practice is for the other two types of playbooks. One approach that seems somewhat reasonable is to have tasks defined outside of main.yml for specific roles (or common if that applies). I just feel like I'm missing something or thinking too hard about this.
-Dan