Configuring Proxmox with Ansible
This past week, I reconfigured my home server to address some issues with the partition scheme. I also used this process as an opportunity to convert most of my bespoke configurations to IaC using Ansible . This was also the first time I took on a large DevOps project with the assistance of ChatGPT. The Ansible project has some great documentation complete with multiple examples of how to use each module, but because the options, and sometimes the syntax, of each modules differs, the process of automating the configuration of a complex server can be a time intensive process of hunting through many pages of documentation looking for the exact syntax of an ansible task so you can move on to automating the next task. In my case, I’m working with a hyperconverged infrastructure system with a hypervisor, container orchestrator, ZFS for file storage, about 10 containerized applications, and a variety of software packages not available in the distro repos. In principal, keeping all your configuration in a framework like Ansible ensures every change is documented and repeatable, but in practice, the time it takes to automate a task is so much greater that it takes to complete it manually, that you make iterative changes to your server over time and this causes undocumented changes and entropy to build up within the system.
For this project I experimented with using ChatGPT to narrow the gap between manual and automated configuration. Working with an LLM is a technique in and of itself. You need to learn how to phrase your questions, refine its output with follow-ups, and when it’s faster to check the docs yourself. I used the excellent Voila tool which wraps ChatGPT in a minimal quick-search interface and allows you to save pre-made prompts to refine the LLM’s output.
This process was incredibly successful. In about the same amount of time as it would have taken me to sysadmin my way to a workable system, I was able to write the configuration code to accomplish the same actions. I wrote a bootstrap playbook which takes the server from the default Proxmox install state to one more to my liking complete with a non-root PAM user and a configured Docker environment. Then I wrote a primary playbook to connect as my new user, install software I depend on, and configure the various services I rely on. Splitting the configuration process across two playbooks allows me to add tasks to the bottom of the primary playbook as I make iterative changes to this server (the steps in the bootstrap playbook are not all idempotent) so that, when I need to reload the machine in the future, every change I have made is stored in version control.
Check out my other side projects and my continuing education in IaC and DevOps .