Collection of automation scripts to deploy and manage my internal home lab environment.
I'm currently using Ansible to deploy some of my servers, including the following:
-
Home Assistant
-
Minecraft Server
-
Glances endpoints
-
Pi-hole(s)
- Deploy both the primary and secondary pi-hole / DNS servers.
-
ProxMox Config
Terraform is used to provision the VMs needed for everything running on my home server(s)
I've structured this such that, each base
VM needed is contained in it's own terraform module so I can create any X amount of that same base config as I want. (See vars.auto.tfvars for an example.)
- PFSense or OPNSense
- Networking Solution (With DHCP) - Currently handled by gateway.
- Internal CI/CD (Jenkins?)
I'm also planning to deploy some of my other servers / services via k8s
in the future. To be decided.
Well... I'd like to think that I have something to contribute to the community, and if my scripts are useful, I'd like to share them. Obviously this reveals a little bit of how I'm configuring my home lab and network, but I would like to still share as much as I can.
When deploying a VM with Terraform, or when Terraform needs to make a change to a VM (nameserver, IP, or anything to make VM reboot, etc), ProxMox will auto-assign a new MAC address to the VM. The behavior of this breaks default SSH authentication without specifying -o StrictHostKeyChecking=no
manually, which I'd like to avoid.
Example of what happens when terraform regenerates a MAC address:
When deploying a NEW
VM, you do not need to specify the MAC Address (macaddr
variable) in your variable map. BUT once the VM is deployed and a MAC exists for that VM, it's a good idea to add that MAC Address to your variable map so Terraform keeps this MAC address and doesn't regenerate it.
Example vars.auto.tfvars
definition of a new VM:
Initial Terraform Deployment
container-host = {
"container-host" = {
hostname = "container-host"
vmid = "107"
ip_address = "10.0.0.7"
}
}
Post-Terraform Deployment
container-host = {
"container-host" = {
hostname = "container-host"
vmid = "107"
ip_address = "10.0.0.7"
macaddr = "06:74:60:C0:37:F6"
}
}
NOTE: You do not actually need to re-run Terraform to update the MAC Address. You can just update the variable map with the new MAC Address. You can confirm your terraform config / state by running terraform plan
to confirm your config matches your state.