Post

I have finally come to realise where my issues have been with Ansible. I was trying to create a single mono-playbook which would run tasks across multiple servers (only two in my case), but it would cause a number of issues

Firstly a mono-playbook is difficult to understand and edit, obviously, but it also meant the output was also difficult to read. If the summary at the end said anything had changed, I would need to read everything to understand what exactly. Not easy with 100s of tasks.

Secondly, and more importantly, I didn't understand the boundaries of my repeatable tasks. Some tasks would be repeated once across all hosts, e.g, installing neovim as the text editor. However other tasks would be repeated multiple times within the same host, such as installing docker containers.

0 reposts0 likes

By having entirely separate playbooks for the different realms of repeatability, I have massively improved my ability to read and understand my code. My containers runbook has a role for installing a single container, but that role is repeated multiple times to install everything I need to run

And my servers runbook simply contains the tasks to install and configure my applications across all hosts.. Knowing my realm of repeatability really helps me to keep tech debt down and keep on iterating and improving.