Enter the automation dream with Ansible and AWX
Dive into the world of automation and discover how it can clear your mind and make your IT work much more organized and peaceful.
Automaception
I try to approach my work—managing IT infrastructures—as relaxed as possible. Paradoxically, that means I spend a lot of time optimizing my work. Fortunately, machines are ideal for that (the game Factorio takes up more time than I care to admit). Computers even more so, which is probably half the reason I work in this field. So when I was introduced to Ansible, I was immediately sold.
It enabled me to let computers manage themselves at the touch of a button. You can neatly organize infrastructure configuration into groups and roles, and the community provides collections to manage a huge number of components. Optimizing the Ansible book and ensuring that the server park is correctly configured and that changes are implemented by the servers in an organized manner is a wonderful challenge. Completing (part of) such an Ansible book feels like pure bliss: you run the playbook and the controller does all the work for you. And you? You have plenty of time to sit back and watch the automation.
But that's exactly where a slight itch slowly starts to develop. It begins in the back of your mind, in a sarcastic tone:
Don't you just love pressing buttons to make computers do things?
And at first you don't understand it, but then it adds:
Wouldn't it be nice if you could automate that too?
And so a vicious circle is created.
So, naturally, a genius (or rather, several geniuses) thought of automating the automation, and thus AWX was born (the upstream version of the Ansible Automation Platform). But that's not enough, of course: we also automate the automation that automates the automation—the configuration of the controller. This is the story of a possible path you can take, past all those turtles.
Disclaimer: You don't need to know much about AWX and/or the infra.controller_configuration collection to read this article. But if you plan to follow my path, I recommend that you do familiarize yourself with it. In any case, it helps if you have a conceptual understanding of how Ansible works.
I'll skip the beginning of my journey and drop you a few months later, at the point where the itch in my head became too loud to ignore. At that time, the team I'm part of managed about 500 virtual and physical servers with one large Ansible book. We were manually running so many playbooks that it was driving us crazy. We had just started running AWX and were in the middle of the migration when a keyboard-loving colleague complained loudly:
I feel like I've reverted to clicking in the AWX web interface instead of actually automating anything!
Everyone knew: a comment like that meant he was onto something. And indeed—it turned out to be two things:
- Managing the actual Ansible code and projects stored and executed in AWX
- Managing AWX itself and the executions of that code
In this article, I will focus on managing AWX itself. I will leave the migration to another time—and perhaps to another writer.
Manage AWX
Conclusion
This new way of working with Ansible not only offers the team a more robust way to manage the infrastructure, but also provides greater scalability. In addition to the benefits for ourselves, the organization also gains better insight into the status of the underlying infrastructure.
But the most important result is, of course, this: I can finally sit back and watch our servers manage themselves. It's a wonderful feeling—a job well done. My team and I now have time to think about new features or help the organization improve itself further. Does something need to be adjusted? Then I modify the code, commit it to GitLab, and watch the magic unfold. A true technological marvel.
…
“Don't you love pressing buttons to make computers do things?”
…
“Wouldn't it be nice if you could automate that too?”
Will I ever be able to silence that annoying little voice in my head? Or could AI finally quiet that voice for me?
Final Thoughts
This blog post is based on an actual implementation I carried out for a client, but some parts have been modified to better fit the story. A few comments on these modifications:
- GitOps was already in use, but has been further expanded and well integrated rather than implemented entirely from scratch.
- Many peripheral issues have been simplified or omitted; otherwise, this article would quickly have turned into a white paper.
- In my opinion, implementing secret management in AWX is not a trivial matter and requires a great deal of attention and care.
- The way changes in your Ansible books affect your projects and jobs is an interesting but challenging puzzle in itself.
AWX is only supported via the AWX Operator on Kubernetes. Those are dragons—you have been warned. But to be fair, they are incredibly cool.