b8df43b209de50c1e758d1a362a11cbf31da26e3
iac-homelab
Description
This repository contains Infrastructure as Code (IaC) configurations for a home lab environment. It includes Terraform scripts for provisioning infrastructure resources and Ansible playbooks for configuring those resources.
Usage
Prerequisites
- Terraform installed on your machine
- Ansible installed on your machine
- Proxmox VE installed on homelab
Proxmox Role and User
The Proxmox role is responsible for configuring Proxmox VE on the homelab. It includes tasks for setting up the Proxmox VE cluster, creating virtual machines, and configuring storage.
Following the least privilege principle, the role creates a dedicated user account with limited permissions for managing the Proxmox VE cluster.
pveum role add TerraformProv -privs "Datastore.Allocate Datastore.AllocateSpace Datastore.Audit Pool.Allocate Sys.Audit Sys.Console Sys.Modify VM.Allocate VM.Audit VM.Clone VM.Config.CDROM VM.Config.Cloudinit VM.Config.CPU VM.Config.Disk VM.Config.HWType VM.Config.Memory VM.Config.Network VM.Config.Options VM.Console VM.Migrate VM.Monitor VM.PowerMgmt SDN.Use"
Create a dedicated user account with limited permissions for managing the Proxmox VE cluster.
pveum user add terraform@pve --password <password>
pveum acl modify / -user terraform@pve -role TerraformProv
Generate API keys for the Proxmox VE cluster.
pveum user token add terraform@pve terraform -expire 0 -privsep 0 -comment "Terraform token"
Provisioning Infrastructure
- Clone this repository to your local machine.
- Navigate to the
terraform/proddirectory. - Run
terraform initto initialize the Terraform environment. - Run
terraform planto preview the infrastructure changes. - Run
terraform applyto apply the infrastructure changes.
Configuring Infrastructure
- Navigate to the
ansibledirectory. - Run
ansible-playbook playbooks/setup_dns_server.ymlto set up the DNS server. (Oransible-playbook playbooks/update_dns_records.ymlto update DNS records).
Description
This repository contains Infrastructure as Code (IaC) configurations for a home lab environment.
Languages
HCL
100%