Switching to Ansible
How I turned away from Ansible, and then eventually came back around to it.
Giving Ansible another try
A while ago, probably a year (okay so not that long ago), I began taking CaC and IaC more seriously in my home lab. It has grown from 1 server to 3 servers now, plus 2 VPSes, and some servers I manage for friends. It was time for me to bring everything up to a standard, and that standard was to be defined with a tool such as Ansible. I’ll admit when I first started working with it I was unhappy with the way it functioned. It felt limited and I still wasn’t in the mindset of defining a configuration to achieve. I was still operating under a task-based configuration rather than state-based.
When I first started exploring CaC and IaC tools (I know Ansible isn’t for infrastructure, but it can automate just enough that I don’t need another tool just yet) I really did not enjoy working with Ansible. I wanted to define steps to take to achieve a state, like the tasks I performed when I would configure servers manually. Ansible does not work this way for better or worse. Instead Ansible wants states and it runs all the steps to put servers into those states. I have since come around to this way of operating, and currently prefer it.
So what did I use instead? Why am I switching back? I will start with the first. I used pyinfra which I actually really enjoy. It is great and I am not going back to Ansible because it is a bad tool. It gave me exposure to the world of CaC and understanding how it works. It also let me create deploys/plays/actions how I wanted to at the time. It gave me an appreciation for automating configuration. As for why I am switching back, I think my mindset about the approach changed. I really like pyinfra, and it is super powerful and I think much more user-friendly than Ansible. It was a great place to get started. However I want to try out Ansible now.
I felt like pyinfra was a little too open-ended and I could really do anything in any way, which is great. I am just looking for more guardrails. I want to spend less time working on my CaC tools and building crazy deploys to do the things I want. Ansible is more widely adopted and used so I am also more likely to find a playbook that someone has shared that can do all the things I might want. In essence I want to spend less time with my CaC tools and more time actually playing around and experimenting with my homelab.
I really like pyinfra and still do, but I want my CaC to be boring, so I am giving Ansible another shot now that I have a much better grasp on the concepts and operation of it.