Homelab Core Components for Proxmox
# create role and set privileges
pveum role add PackerProv -privs "Pool.Audit Datastore.AllocateSpace Datastore.Allocate Datastore.Audit VM.Allocate VM.Audit VM.Backup VM.Clone VM.Config.CDROM VM.Config.CPU VM.Config.Cloudinit VM.Config.Disk VM.Config.HWType VM.Config.Memory VM.Config.Network VM.Config.Options VM.Console VM.Migrate VM.Monitor VM.PowerMgmt VM.Snapshot VM.Snapshot.Rollback SDN.Use"
# create user
pveum user add packer@pve --password Pack3rPr0v1s10n1ng
# set permissions
pveum aclmod / -user packer@pve -role PackerProv
# create API token
# this command outputs values needed for authentication
pveum user token add packer@pve packer-automation --privsep 0Create the secrets file with values from the last command
pm_api_url = "<your proxmox api url>"
pm_api_token_id = "<your proxmox user>"
pm_api_token_secret = "<proxmox user api token>"Change the values of the variables ssh_username and ssh_private_key_file in the packer/ubuntu-server/variables.pkr.hcl file.
Be sure to upload the Ubuntu Server images needed for create the templates, check this file and search for iso_file entries.
packer init packer/ubuntu-server
packer validate packer/ubuntu-server
packer build packer/ubuntu-server# create role and set privileges
pveum role add TerraformProv -privs "Datastore.AllocateSpace Datastore.AllocateTemplate 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.Migrate VM.Monitor VM.PowerMgmt SDN.Use"
# create user (set <password> to a password of your choice)
pveum user add terraform@pve --password T3rraf0rmPr0v1s10n1ng
# set permissions
pveum aclmod / -user terraform@pve -role TerraformProv
# create API token
# this command outputs values needed for authentication
pveum user token add terraform@pve terraform-automation --privsep 0Create the secrets file with values from the last command
pm_api_url = "<your proxmox api url>"
pm_api_token_id = "<your proxmox user>"
pm_api_token_secret = "<proxmox user api token>"This repository uses HCP Terraform for remote backend. Check the terraform/versions.tf file for more info.
Be sure to upload the Ubuntu template needed for create LXC, check this file and set ostemplate variable.
If you don't see the image you want try running pveam update on the proxmox server.
cd terraform
terraform init
terraform plan
terraform applyCheck Packer documentation
Check Terraform documentation
Check Ansible documentation