Skip to content

Automation

Automation makes your lab disposable. When you can rebuild something in minutes, you stop being afraid to break it, and you learn faster. These are also some of the most valuable skills you can bring to a job.

Don’t try to automate everything at once. Start with whatever you keep repeating.

  1. Keep your configuration in Git. Compose files, scripts and notes all belong in version control. Host your repositories on Forgejo or GitLab, or a hosted service. Keep secrets out of your repository.
  2. Build templates. Use a VM template, and cloud-init to set the hostname, users and SSH keys at first boot. Packer builds the images themselves.
  3. Configure with Ansible. It’s agentless, working over SSH or WinRM, and it’s a very common job skill. Write a playbook that does your baseline: users, updates, monitoring agents and so on.
  4. Provision with infrastructure as code. Define your VMs and networks in Terraform or OpenTofu.
  5. Run it all from a pipeline. Apply changes when you push to Git. This gets you into CI/CD and GitOps.
Tool What it’s for Notes
Ansible Configuration and orchestration The best place to start. AWX and Semaphore add a web interface
OpenTofu Provisioning infrastructure An open source fork of Terraform
Terraform Provisioning infrastructure The industry standard, now under the Business Source License. Both have community Proxmox providers
Packer Building VM images Makes consistent templates
cloud-init First-boot setup Supported by most Linux images and hypervisors
Flux or Argo CD GitOps for Kubernetes The cluster keeps itself matched to your Git repository
NixOS Declaring a whole OS Very reproducible, with a steep learning curve
Puppet and Chef Configuration management Still found in enterprises, but with less of the mindshare and fewer community guides. Check current open source licensing. The community fork of Puppet is OpenVox. Learn them if your job needs them

Forgejo Actions, GitLab CI and GitHub Actions can test and deploy your changes. Use self-hosted runners with care on public repositories, since anyone can open a pull request that could run code on your network.

Jenkins remains widely used in business and is worth learning if your workplace uses it. It’s also a useful scheduler. Its web interface shows the history and output of every job, and you can run scripts against your machines over SSH without installing an agent on each of them. This makes it a nicer way to see what happened than cron, if you’re willing to maintain Java and plugins.

For simple schedules, systemd timers are built in and log to the journal.

PowerShell works on Windows, Linux and macOS, and there are modules for Hyper-V and for VMware (VCF PowerCLI). Python and Bash are useful for everything else. A hypervisor’s API is usually the most flexible way to automate it. Proxmox, for example, has a full REST API.