This repository contains the Packer build configurations and automated answer files used to generate the baseline machine images for my infrastructure environment.
Packer perfectly complements orchestration workflows. I adopted it when using Terraform; I acknowledged the limits with it being an infrastructure provisioning tool. Without a pre-configured image, the machines will be installed from whatever ISO file I used and be completely independent machines in terms of software installed, SSH running, QEMU agent installed and enabled for Proxmox hosted machines, etc.
This project bridges the gap between orchestration and immutable server deployment. By integrating these disciplines, this repository demonstrates several core NetDevOps methodologies:
- Immutable Infrastructure (Packer & State Management): Enforces a defined, reproducible state for machine images. This eliminates configuration drift and ensures idempotency across every deployment.
- Zero-Touch Provisioning (Unattended OS Configuration): Leverages
preseed.cfg,autounattend.xml, andcloud-initto entirely remove manual intervention from the deployment pipeline. - Scalable Deployments (Virtualization & API Integration): Integrates directly with the Proxmox VE API for bare-metal automated builds, utilizing a declarative HCL baseline that can easily scale across AWS, Azure, GCP, and Hyper-V.
- CI/CD Methodology: Enables a true "disposable infrastructure" model. Machine environments can be destroyed and recreated within a single automated pipeline run, reflecting enterprise-grade configuration management.
- Vast Documentation & Official Guide: Supported by comprehensive documentation, practical examples, and the official guide available directly via the HashiCorp Packer Documentation.
Configurations are separated by operating system to maintain a clean, modular image factory. Unattended installation files (preseed.cfg, autounattend.xml, cloud-init) are nested within their respective builds to ensure agnostic deployments.
.
├── kali/
│ ├── kali.pkr.hcl
│ └── http/
│ └── preseed.cfg
├── ubuntu_desktop/
│ ├── ubuntu-desktop.pkr.hcl
│ └── http/
│ ├── meta-data
│ └── user-data
├── ubuntu_server/
│ ├── ubuntu-server.pkr.hcl
│ └── http/
│ ├── meta-data
│ └── user-data
├── win11/
│ ├── win11.pkr.hcl
│ └── autounattend.xml
└── winserver_2k19/
├── winserver-2k19.pkr.hcl
└── autounattend.xml
Initialize the working directory to download and install the necessary plugins (such as the Proxmox builder plugin):
packer init .Run a validation check against your template files to ensure there are no syntax errors or invalid configurations before starting a build:
packer validate .Execute the build pipeline using your configurations:
packer build .To keep these templates agnostic and secure, never hardcode sensitive environment details directly into the pkr.hcl files.
You must pass your specific environment details to Packer using a .pkrvars.hcl file. Ensure your .gitignore is actively blocking any .env or .pkrvars.hcl files from being pushed to version control.
Example secrets.pkrvars.hcl:
proxmox_api_url = "[https://10.0.0.](https://10.0.0.)X:8006/api2/json"
proxmox_api_id = "packer@pve!automation"
proxmox_api_token = "your-secret-token-here"
proxmox_node = "pve-01"Run the build by appending the variable flag:
packer build -var-file="../secrets.pkrvars.hcl" .If a build hangs during the hypervisor boot sequence or the unattended answer file stalls without throwing an error back to your terminal, you need raw output. Enable verbose logging by appending PACKER_LOG=1 to your build execution:
PACKER_LOG=1 packer build .Maintain a clean and standardized repository. Before committing any pipeline changes, format your HCL code to HashiCorp's official standard:
packer fmt .Visualizing the unattended configuration process via the Proxmox console:
- Use Trusted Public Answer File Generators and Official Sites for Assistance Constructing Answer files:
- Windows: Schneegans Windows Unattend Generator and the Official Microsoft Sysprep Docs.
- Ubuntu: Ubuntu Autoinstall Configuration Manual for exact Subiquity syntax.
- Debian: Official Debian Preseed Example.
- Baseline template saves hours and gives a ready baseline for any infrastructure, adding to my understanding of continuous delivery/integration and version control infrastructure.




