This repo contains the definition as code
to recreate configuration of my Proxmox home lab.
The installation/configuration of proxmox itself is out-of-scope and is not included in this repo.
The lab is actually composed of 3 nodes, each one with the following specs:
VLAN is used to separate traffic between VMs and the rest of the networks
Current configuration is:
I decided to split the infrastructure into 2 different levels:
Low level infrastructure in this repo is managed by terraform packer and ansible.
In this directory you will find all the code needed to:
The terraform state is stored on terraform cloud free plan.
High level infrastructure in this repo is managed by flux and sometimes helm some others kustomize.
In this directory you will find all the code needed to:
You will find a envs
subdirectory referencing each kubernetes cluster
cd packer
packer init
export USER_SSH_KEY=$(cat ~/.ssh/id_rsa.pub)
packer build -var username='proxmox_username' -var token='proxmox_api_token' -var sshkey=${USER_SSH_KEY} .
cd terraform
terraform init
export PM_API_TOKEN_ID="username@pve!token_name"
export PM_API_TOKEN_SECRET="a-valid-token-secret"
terraform plan
terraform apply
The CI/CD pipeline is based on Github Actions running on self-hosted runners. Opening a PR will trigger a pipeline that:
packer
folder, it will rebuild the VM template on test nodeterraform
folder, it will run a terraform apply
to test the changes on test nodeansible
folder, it will run a ansible-lint
and molecule testsMerging the PR will trigger a pipeline that:
packer
folder, it will rebuild the VM template on prod nodeterraform
folder, it will run a terraform apply
to apply the changes on prod nodeThe high-level
directory contains everything synced by flux on the prod node. Merging changes on main
branch will be automatically applied on the relative clusters.