Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automated Homelab Project

This project is a learning exercise in Infrastructure as Code, aka GitOps, using Proxmox, Packer, and Terraform to deploy a homelab environment with minimal overhead.

Packer is utilized to build both a cloud-init template for deploying virtual machines and CT templates for deploying LXC containers. The Packer plugin for Proxmox from Hashicorp is used to build the vm template, while distrobuilder is used in tandem to create the CT templates.

Once templates are built, Terraform can be used to deploy a live environment in moments via the Telmate Proxmox provider. This environment will include lxc containers running samba to share data and pi-hole to provide dns, and a docker virtual machine to run additional containers.

Various packages are included in the generated images, such as bat, btop, eza, ncdu, neovim, nnn, starship, tldr, and lazydocker (vm only).

Quickstart

  • Host
  • Local
    • Ensure local environment has Packer and Terraform installed
    • /packer
      • Copy template.pkrvars.hcl to secrets.auto.pkrvars.hcl and populate values
      • Update http/user-data with your public ssh key and desired nonroot_user (Default is 'ubuntu')
        • If changing default nonroot user, be sure to update /distrobuilder/ubuntu.yaml as well.
      • Initialize Packer and run packer build . to create container and VM templates
    • /terraform
      • Copy template.tfvars to secrets.auto.tfvars and populate values
      • Initialize Terraform and run terraform apply to deploy to target Proxmox node
      • SSH into the samba container to run sudo passwd ubuntu and sudo smbpasswd -a ubuntu, completing samba user setup
        • Substitute your own nonroot_user value as needed

Storage Configuration

As configured, the project expects the following folder structure on the host:

  • /data-pool

    • /container-data
      • This folder will be used for lxc and docker data
      • /pihole/setupVars.conf
        • This file is used for automated pi-hole setup
    • /share-data
      • This folder will be shared to the network

To Do List

  • Update README.md
  • Known issue: Group permissions should be smb-share
  • Docker integrations (portainer, lazydocker)
  • Add aliases and configuration for installed packages (.bashrc, starship.toml, etc)
  • Add variable descriptions and constraints
  • Explore dynamic values for distrobuilder and packer user-data
  • Investigate adding Ansible to reduce provisioning complexity

Resources

About

A small IaC project for deploying LXC containers and Cloud-Init VMs to Proxmox

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages