Back to articles
I automated my Proxmox homelab and accidentally gave my servers Tarantino names
How-ToDevOps

I automated my Proxmox homelab and accidentally gave my servers Tarantino names

via Dev.to DevOpsAyush Verma

This started because I was lazy. Every time I needed a new container on my Proxmox server, I'd open the web UI, click Create CT, pick a template, type a hostname, set the specs, configure networking, hit create, wait, then SSH in and install the same packages I always install. Fifteen minutes of clicking for something I do regularly. So one evening I wrote a main.tf to automate it. That should have been the end of it. It wasn't. The first version was embarrassing provider "proxmox" { pm_api_url = "https://192.168.2.250:8006/api2/json" } resource "proxmox_lxc" "test_container" { target_node = "proxmox" hostname = "test-lxc" cores = 1 memory = 512 } API URL hardcoded in source. Specs as magic numbers. Want a second container? Copy-paste the whole block. It worked, but anyone looking at this in a code review would have things to say. Then I kept going I split it into proper files. Moved every value into variables with defaults. Added validation so cores = 0 or disk_size = "big" would fail

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
8 views

Related Articles