Where things go
When you add something new, where you put it decides how easy it is to live with afterwards.
How to decide
- The procedure itself → write it as a role. Not as a shell script; with Ansible’s standard modules
- A combination of procedures, with the common processing before and after and the settings → define it as a job, callable by name
- When things run, and in what order → put it in a pipeline. Do not write the flow inside a job; the flow is decided on the flow’s side
- Definitions of jobs and pipelines → put them in the configuration project. It is the trusted place, and definitions are kept in one place there
- On the project side, keep only the specification that calls jobs by name. Do not bring copies of procedures into a project
- An exception you cannot avoid → give it an expiry and record it on the definition side. When the expiry comes, review whether it continues
Why separate them
With the places separated, each change has exactly one home. Fix a procedure and every job that uses it gets the fix. Change a flow and no procedure is touched. A project only calls, so it never has to follow changes to the contents.