### Build Fedora with Kickstart using JSON Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs/builders/iso.mdx This JSON configuration defines a Proxmox ISO builder for Fedora, equivalent to the HCL2 example. It sets up variables, Proxmox connection details, network, storage, and boot commands for a Kickstart installation. ```json { "variables": { "username": "apiuser@pve", "password": "supersecret" }, "builders": [ { "type": "proxmox-iso", "proxmox_url": "https://my-proxmox.my-domain:8006/api2/json", "insecure_skip_tls_verify": true, "username": "{{user `username`}}", "password": "{{user `password`}}", "node": "my-proxmox", "network_adapters": [ { "model": "virtio", "bridge": "vmbr0" } ], "disks": [ { "type": "scsi", "disk_size": "5G", "storage_pool": "local-lvm" } ], "efi_config": { "efi_storage_pool": "local-lvm", "pre_enrolled_keys": true, "efi_type": "4m" }, "iso": { "iso_file": "local:iso/Fedora-Server-dvd-x86_64-29-1.2.iso" }, "http_directory": "config", "boot_wait": "10s", "boot_command": [ " ip=dhcp inst.cmdline inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks.cfg" ], "ssh_username": "root", "ssh_timeout": "15m", "ssh_password": "packer", "template_name": "fedora-29", "template_description": "Fedora 29-1.2, generated on {{ isotime \"2006-01-02T15:04:05Z\" }}" } ] } ``` -------------------------------- ### Install Packer Plugin Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Run `packer init .` to install the declared plugin. The output will confirm the installation path and version. ```bash packer init . # Output: # Installed plugin github.com/hashicorp/proxmox v1.2.2 in ... ``` -------------------------------- ### Serve Unattended Install Files via HTTP Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Serve unattended-install answer files from a local directory using the embedded HTTP server. The server starts before boot commands run. Use {{ .HTTPIP }} and {{ .HTTPPort }} in boot_command to reference it. ```hcl # Directory layout: # ./http/ks.cfg ← Fedora Kickstart # ./http/preseed.cfg ← Debian preseed source "proxmox-iso" "http-server-example" { # ...auth, node, iso config... http_directory = "http" http_port_min = 8100 http_port_max = 8200 # http_interface = "eth0" # optional: pick specific host NIC boot_wait = "5s" boot_command = [ "", "linux auto=true priority=critical url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg" ] } ``` -------------------------------- ### Cloud-Init IP Configuration Example (JSON) Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/clone/cloudInitIpconfig.mdx Provides an example of how to define static IP configurations for cloud-init. Ensure the order matches the network adapters. ```json [ { "ip": "192.168.1.55/24", "gateway": "192.168.1.1", "ip6": "fda8:a260:6eda:20::4da/128", "gateway6": "fda8:a260:6eda:20::1" } ] ``` -------------------------------- ### Proxmox VGA Configuration Example Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/vgaConfig.mdx Example of how to configure the graphics adapter for a Proxmox VM. Specify the adapter type and its associated memory. ```json { "type": "vmware", "memory": 32 } ``` -------------------------------- ### Proxmox Disk Configuration Example Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/diskConfig.mdx Example JSON structure for defining a virtual machine disk configuration. Specify the disk type, size, and storage pool details. ```json [ { "type": "scsi", "disk_size": "5G", "storage_pool": "local-lvm", "storage_pool_type": "lvm" } ] ``` -------------------------------- ### Install Proxmox Packer Plugin via CLI Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs/README.md Alternatively, use the `packer plugins install` command to manage the installation of the Proxmox plugin directly from the command line. ```sh packer plugins install github.com/hashicorp/proxmox ``` -------------------------------- ### Install Proxmox Packer Plugin Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs/README.md Add this configuration to your Packer file to install the Proxmox plugin. Run `packer init` to apply changes. ```hcl packer { required_plugins { name = { version = "~> 1" source = "github.com/hashicorp/proxmox" } } } ``` -------------------------------- ### Build Fedora with Kickstart using HCL2 Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs/builders/iso.mdx This HCL2 configuration defines a Proxmox ISO builder for Fedora. It specifies variables for username and password, and configures the ISO source, network, storage, and boot commands for a Kickstart installation. ```hcl variable "password" { type = string default = "supersecret" } variable "username" { type = string default = "apiuser@pve" } source "proxmox-iso" "fedora-kickstart" { boot_command = [" ip=dhcp inst.cmdline inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg"] boot_wait = "10s" disks { disk_size = "5G" storage_pool = "local-lvm" type = "scsi" } efi_config { efi_storage_pool = "local-lvm" efi_type = "4m" pre_enrolled_keys = true } http_directory = "config" insecure_skip_tls_verify = true iso { iso_file = "local:iso/Fedora-Server-dvd-x86_64-29-1.2.iso" } network_adapters { bridge = "vmbr0" model = "virtio" } node = "my-proxmox" password = "${var.password}" proxmox_url = "https://my-proxmox.my-domain:8006/api2/json" ssh_password = "packer" ssh_timeout = "15m" ssh_username = "root" template_description = "Fedora 29-1.2, generated on ${timestamp()}" template_name = "fedora-29" username = "${var.username}" } build { sources = ["source.proxmox-iso.fedora-kickstart"] } ``` -------------------------------- ### JSON PCI Device Passthrough Configuration Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/pciDeviceConfig.mdx This JSON configuration achieves the same PCI device passthrough as the HCL2 example. Ensure either the `host` or `mapping` key is specified for a minimal setup. VMs with passed-through devices are not eligible for migration. ```json { "pci_devices": { "host" : "0000:0d:00.1", "pcie" : false, "device_id" : "1003", "legacy_igd" : false, "mdev" : "some-model", "hide_rombar" : false, "romfile" : "vbios.bin", "sub_device_id" : "", "sub_vendor_id" : "", "vendor_id" : "15B3", "x_vga" : false } } ``` -------------------------------- ### Install Proxmox Plugin with packer init Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/README.md Use this HCL code within your Packer configuration to declare the Proxmox plugin. Run `packer init` to automatically install it. Ensure you are using Packer version 1.7 or later. ```hcl packer { required_plugins { proxmox = { version = ">= 1.2.2" source = "github.com/hashicorp/proxmox" } } } ``` -------------------------------- ### Cloud-Init Enabled Debian Image Creation (JSON) Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs/builders/clone.mdx This JSON configuration defines a Proxmox clone builder for Packer, equivalent to the HCL2 example. It sets up the builder to clone a Debian 10 VM from a specified template, including network and authentication parameters. ```json { "variables": { "proxmox_username": "apiuser@pve", "proxmox_password": "supersecret" }, "builders": [ { "type": "proxmox-clone", "proxmox_url": "https://my-proxmox.my-domain:8006/api2/json", "username": "{{user `proxmox_username`}}", "password": "{{user `proxmox_password`}}", "ssh_username": "root", "node": "pve", "insecure_skip_tls_verify": true, "clone_vm": "debian-10-4", "template_name": "debian-scaffolding", "template_description": "image made from cloud-init image", "pool": "api-users", "os": "l26", "cores": 1, "sockets": 1, "memory": 2048, "network_adapters": [ { "model": "virtio", "bridge": "vmbr0" } ] } ] } ``` -------------------------------- ### Proxmox VM Network Adapter Configuration Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/NICConfig.mdx Example of a JSON array defining network adapters for a Proxmox VM. Each object specifies the NIC model, network bridge, VLAN tag, and firewall status. ```json [ { "model": "virtio", "bridge": "vmbr0", "vlan_tag": "10", "firewall": true } ] ``` -------------------------------- ### Declare Packer Plugin Requirement Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Declare the proxmox plugin requirement in your Packer HCL template. `packer init` will automatically download and install the correct binary. ```hcl # versions.pkr.hcl packer { required_plugins { proxmox = { version = ">= 1.2.2" source = "github.com/hashicorp/proxmox" } } } ``` -------------------------------- ### Configure proxmox-iso Builder for Fedora Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt This configuration uses the `proxmox-iso` builder to create a Fedora VM template. It specifies Proxmox connection details, VM hardware, boot ISO, additional ISOs for drivers, HTTP server for kickstart, and SSH credentials for provisioning. ```hcl # fedora-kickstart.pkr.hcl variable "proxmox_url" { default = "https://pve.example.com:8006/api2/json" } variable "proxmox_username" { default = "packer@pve!tokenid" } variable "proxmox_token" { default = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } source "proxmox-iso" "fedora" { proxmox_url = var.proxmox_url username = var.proxmox_username token = var.proxmox_token insecure_skip_tls_verify = true node = "pve01" vm_name = "fedora-template" vm_id = 9000 template_name = "fedora-40" template_description = "Fedora 40 base image, built ${timestamp()}" tags = "fedora;template;packer" os = "l26" cores = 2 sockets = 1 memory = 2048 cpu_type = "host" bios = "ovmf" efi_config { efi_storage_pool = "local-lvm" efi_type = "4m" pre_enrolled_keys = true } machine = "q35" scsi_controller = "virtio-scsi-single" disks { type = "scsi" storage_pool = "local-lvm" disk_size = "20G" format = "raw" io_thread = true discard = true ssd = true } network_adapters { model = "virtio" bridge = "vmbr0" firewall = true } boot_iso { type = "scsi" iso_file = "local:iso/Fedora-Server-dvd-x86_64-40-1.14.iso" iso_checksum = "sha256:73f219b40460ad826f972b2e0e9f98c44dcd9d2e13cf6f5df6b7a0e9eab4c8c0" unmount = true } additional_iso_files { type = "scsi" iso_url = "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso" iso_checksum = "none" iso_storage_pool = "local" unmount = true } http_directory = "http" # serves http/ks.cfg boot_wait = "10s" boot_command = [ " ip=dhcp inst.cmdline inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" ] qemu_agent = true cloud_init = true cloud_init_storage_pool = "local-lvm" ssh_username = "root" ssh_password = "packer" ssh_timeout = "20m" } build { sources = ["source.proxmox-iso.fedora"] provisioner "shell" { inline = [ "dnf -y update", "dnf clean all" ] } } # Expected artifact: Proxmox template VMID 9000 named "fedora-40" ``` -------------------------------- ### Configure Additional ISO Files Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Attach supplemental ISO images (e.g., VirtIO drivers, cloud-init data ISOs). Use 'iso_file' for a pre-uploaded Proxmox datastore path, or 'iso_url' + 'iso_storage_pool' for automatic download and upload. 'cd_files' / 'cd_content' generate an ISO from local files on the fly. ```hcl source "proxmox-iso" "iso-example" { # ...auth and node config... # Pre-uploaded ISO already on the Proxmox node additional_iso_files { type = "scsi" iso_file = "local:iso/virtio-win-0.1.240.iso" unmount = true } # Auto-downloaded and uploaded to Proxmox additional_iso_files { type = "ide" iso_url = "https://example.com/drivers.iso" iso_checksum = "sha256:abc123..." iso_storage_pool = "local" unmount = true } # Generated from local files (e.g., custom cloud-init NoCloud) additional_iso_files { type = "ide" iso_storage_pool = "local" cd_files = ["./cloud-init/user-data", "./cloud-init/meta-data"] unmount = true } } ``` -------------------------------- ### Configure Virtual Network Adapters Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Attach virtual NICs to the VM. 'bridge' is required for each NIC. 'model' defaults to 'e1000'; use 'virtio' for best performance. 'packet_queues' is only valid with the 'virtio' model. ```hcl source "proxmox-iso" "nic-example" { # ...auth and node config... network_adapters { model = "virtio" bridge = "vmbr0" vlan_tag = "10" firewall = true mac_address = "repeatable" # deterministic MAC based on VM ID mtu = 1500 packet_queues = 2 # multiqueue; set to number of vCPU cores } network_adapters { model = "e1000" bridge = "vmbr1" vlan_tag = "20" } } ``` -------------------------------- ### Configure Boot ISO in Proxmox Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/iso/Config-required.mdx Defines the boot ISO for a Proxmox virtual machine. Specify the ISO file path, type, and whether to unmount it after use. An optional checksum can be provided for verification. ```json "boot_iso": { "type": "scsi", "iso_file": "local:iso/debian-12.5.0-amd64-netinst.iso", "unmount": true, "iso_checksum": "sha512:33c08e56c83d13007e4a5511b9bf2c4926c4aa12fd5dd56d493c0653aecbab380988c5bf1671dbaea75c582827797d98c4a611f7fb2b131fbde2c677d5258ec9" } ``` ```hcl boot_iso { type = "scsi" iso_file = "local:iso/debian-12.5.0-amd64-netinst.iso" unmount = true iso_checksum = "sha512:33c08e56c83d13007e4a5511b9bf2c4926c4aa12fd5dd56d493c0653aecbab380988c5bf1671dbaea75c582827797d98c4a611f7fb2b131fbde2c677d5258ec9" } ``` -------------------------------- ### Attach Cloud-Init CDROM Drive Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Attach an empty Cloud-Init CDROM drive to the finished template. This is used when cloud_init is true to provide configuration to downstream VMs. ```hcl source "proxmox-iso" "ci-example" { # ...auth and node config... cloud_init = true cloud_init_storage_pool = "local-lvm" cloud_init_disk_type = "ide" # ide | scsi | sata; defaults to ide } ``` -------------------------------- ### Proxmox Authentication Methods Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Demonstrates different ways to authenticate with Proxmox, including using an API token (recommended), a legacy password, or environment variables for credentials. Ensure the correct username format is used for API tokens. ```hcl # Using API token (recommended) source "proxmox-iso" "example" { proxmox_url = "https://pve.example.com:8006/api2/json" username = "packer@pve!mytoken" # user@realm!tokenid token = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" insecure_skip_tls_verify = false node = "pve01" # ... rest of config } # Using password (legacy) source "proxmox-iso" "example-pw" { proxmox_url = "https://pve.example.com:8006/api2/json" username = "packer@pve" password = "s3cr3t" node = "pve01" # ... rest of config } # Using environment variables (no credentials in template file) # export PROXMOX_URL="https://pve.example.com:8006/api2/json" # export PROXMOX_USERNAME="packer@pve!mytoken" # export PROXMOX_TOKEN="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" source "proxmox-iso" "example-env" { node = "pve01" # proxmox_url / username / token read from env } ``` -------------------------------- ### Send Key Sequences to VM Console Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Send key sequences to the VM console during initial boot. Boot commands are sent character-by-character with boot_key_interval delay. Special keys use angle-bracket notation. ```hcl source "proxmox-iso" "bootcmd-example" { # ...config... boot_wait = "10s" boot_key_interval = "10ms" # or set PACKER_KEY_INTERVAL env var boot_command = [ "", # open boot menu "linux /vmlinuz", " auto=true", " url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg", " hostname=packer", "", "initrd /initrd.gz", "boot" ] } ``` -------------------------------- ### Configure Cloud-Init IP Addresses Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Set per-interface IP addresses and gateways via Cloud-Init. Index order matches the network_adapters list. Supports IPv4 CIDR or 'dhcp', IPv6 CIDR, 'auto' (SLAAC), or 'dhcp'. ```hcl source "proxmox-clone" "ipconfig-example" { # ...auth and node config... clone_vm = "ubuntu-22-cloud" network_adapters { model = "virtio" bridge = "vmbr0" } network_adapters { model = "virtio" bridge = "vmbr1" } # interface 0 — static IPv4 + DHCPv6 ipconfig { ip = "192.168.1.100/24" gateway = "192.168.1.1" ip6 = "dhcp" } # interface 1 — full DHCP ipconfig { ip = "dhcp" ip6 = "auto" } nameserver = "1.1.1.1 9.9.9.9" searchdomain = "internal.example.com" } ``` -------------------------------- ### Cloud-Init Enabled Debian Image Creation (HCL2) Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs/builders/clone.mdx This HCL2 configuration defines a Proxmox clone builder to create a Debian 10 image from an existing Cloud-Init enabled template. It specifies network settings, VM resources, and authentication details. ```hcl variable "proxmox_password" { type = string default = "supersecret" } variable "proxmox_username" { type = string default = "apiuser@pve" } source "proxmox-clone" "debian" { clone_vm = "debian-10-4" cores = 1 insecure_skip_tls_verify = true memory = 2048 network_adapters { bridge = "vmbr0" model = "virtio" } node = "pve" os = "l26" password = "${var.proxmox_password}" pool = "api-users" proxmox_url = "https://my-proxmox.my-domain:8006/api2/json" sockets = 1 ssh_username = "root" template_description = "image made from cloud-init image" template_name = "debian-scaffolding" username = "${var.proxmox_username}" } build { sources = ["source.proxmox-clone.debian"] } ``` -------------------------------- ### Configure Additional ISO Files in JSON Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/ISOsConfig.mdx Use this JSON structure to define additional ISO files to be attached to a virtual machine. Specify the type, path, unmount behavior, and checksum. ```json "additional_iso_files": [ { "type": "scsi", "iso_file": "local:iso/virtio-win-0.1.185.iso", "unmount": true, "iso_checksum": "af2b3cc9fa7905dea5e58d31508d75bba717c2b0d5553962658a47aebc9cc386" } ] ``` -------------------------------- ### Configure TPM Module Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Attach a virtual Trusted Platform Module. Use 'tpm_version = "v2.0"' for Windows 11 or any workload requiring TPM 2.0. ```hcl source "proxmox-iso" "tpm-example" { # ...auth and node config... bios = "ovmf" machine = "q35" efi_config { efi_storage_pool = "local-lvm" efi_type = "4m" } tpm_config { tpm_storage_pool = "local-lvm" tpm_version = "v2.0" # "v1.2" or "v2.0" } } ``` -------------------------------- ### Configure EFI Firmware and Storage Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Configure OVMF UEFI firmware and EFI disk storage. Required when 'bios = "ovmf"'. Use 'efi_type = "4m"' for modern UEFI and set 'pre_enrolled_keys = true' to enroll Microsoft Secure Boot keys automatically. ```hcl source "proxmox-iso" "uefi-example" { # ...auth and node config... bios = "ovmf" machine = "q35" efi_config { efi_storage_pool = "local-lvm" efi_type = "4m" # "2m" or "4m" pre_enrolled_keys = true efi_format = "raw" } } ``` -------------------------------- ### Configure Virtual Graphics Adapter Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Set the virtual graphics adapter type and memory. Use 'none' for headless servers or PCI passthrough with legacy IGD. ```hcl source "proxmox-iso" "vga-example" { # ...auth and node config... vga { type = "virtio" # cirrus|none|qxl|std|virtio|vmware|serial0-3 memory = 64 # MB of video RAM } } ``` -------------------------------- ### Proxmox EFI Storage Configuration (JSON) Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/efiConfig.mdx Set the efidisk storage options when using OVMF UEFI boot. This requires specifying the storage pool, pre-enrolled keys status, and the EFI format and type. ```json { "efi_storage_pool": "local", "pre_enrolled_keys": true, "efi_format": "raw", "efi_type": "4m" } ``` -------------------------------- ### Proxmox Clone Artifact Builder Configuration Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Configures the proxmox-clone artifact builder to clone an existing Proxmox VM, inject Cloud-Init settings, and convert it to a new template. Ensure Cloud-Init is enabled and the SSH username is correctly set for communication. ```hcl # debian-cloud-init.pkr.hcl variable "proxmox_url" { default = "https://pve.example.com:8006/api2/json" } variable "proxmox_user" { default = "packer@pve" } variable "proxmox_pass" { default = env("PROXMOX_PASSWORD") } source "proxmox-clone" "debian" { proxmox_url = var.proxmox_url username = var.proxmox_user password = var.proxmox_pass insecure_skip_tls_verify = false node = "pve01" pool = "infra-templates" # Source template to clone clone_vm = "debian-12-cloud" # or use clone_vm_id = 8000 full_clone = true vm_name = "debian-12-packer" template_name = "debian-12-base" template_description = "Debian 12 hardened base, built ${timestamp()}" tags = "debian;template" os = "l26" cores = 2 memory = 2048 cpu_type = "host" network_adapters { model = "virtio" bridge = "vmbr0" firewall = true vlan_tag = "100" } # Cloud-Init networking (index matches network_adapters order) ipconfig { ip = "dhcp" ip6 = "auto" } nameserver = "1.1.1.1 8.8.8.8" searchdomain = "example.com" cloud_init = true cloud_init_storage_pool = "local-lvm" qemu_agent = true ssh_username = "debian" ssh_timeout = "10m" # SSH key is auto-generated and injected via Cloud-Init when no communicator is set; # explicit password auth also works: # ssh_password = "packer" } build { sources = ["source.proxmox-clone.debian"] provisioner "shell" { inline = [ "sudo apt-get update -y", "sudo apt-get install -y qemu-guest-agent cloud-init", "sudo systemctl enable qemu-guest-agent", "sudo apt-get clean" ] } } # Expected artifact: new Proxmox template named "debian-12-base" ``` -------------------------------- ### Configure VirtIO Random Number Generator Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Provide entropy from the host to the guest VM. Prevents entropy starvation inside the VM. Always set a rate limit ('max_bytes' + 'period') to protect host resources. ```hcl source "proxmox-iso" "rng-example" { # ...auth and node config... rng0 { source = "/dev/urandom" # /dev/urandom | /dev/random | /dev/hwrng max_bytes = 1024 # bytes injected per period; 0 = unlimited (dangerous) period = 1000 # milliseconds between quota resets } } ``` -------------------------------- ### Configure Additional ISO Files in HCL2 Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/ISOsConfig.mdx This HCL2 block configures additional ISO files for a virtual machine. It includes settings for type, ISO file path, unmount preference, and checksum. ```hcl additional_iso_files { type = "scsi" iso_file = "local:iso/virtio-win-0.1.185.iso" unmount = true iso_checksum = "af2b3cc9fa7905dea5e58d31508d75bba717c2b0d5553962658a47aebc9cc386" } ``` -------------------------------- ### Configure Proxmox RNG0 with JSON Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/rng0Config.mdx This JSON object configures a VirtIO Random Number Generator for a Proxmox VM. It includes the host device source, maximum bytes, and update period. ```json { "rng0": { "source": "/dev/urandom", "max_bytes": 1024, "period": 1000 } } ``` -------------------------------- ### Configure SSH Communicator Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Configure the SSH communicator for connecting to the provisioned VM. If no communicator is defined, Packer auto-generates an SSH key pair and injects it via Cloud-Init. ```hcl source "proxmox-iso" "ssh-example" { # ...config... # SSH communicator (default) ssh_username = "packer" ssh_password = "packer" # or use ssh_private_key_file ssh_timeout = "15m" ssh_handshake_retries = 20 # ssh_host = "192.168.1.50" # override QEMU agent IP detection vm_interface = "eth0" # pick IP from specific guest NIC qemu_agent = true # required for automatic IP detection } ``` -------------------------------- ### Configure TPM State Storage (HCL2) Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/tpmConfig.mdx Use this HCL2 configuration block to set the storage pool and version for the TPM state. Ensure the specified pool exists in your Proxmox environment. ```hcl tpm_config { tpm_storage_pool = "local" tpm_version = "v1.2" } ``` -------------------------------- ### Attach Serial Devices Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Attach up to four serial devices. Each entry must be 'socket' or a host device path matching /dev/.+. ```hcl source "proxmox-iso" "serial-example" { # ...auth and node config... serials = ["socket", "/dev/ttyS0"] } ``` -------------------------------- ### Configure WinRM Communicator Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Configure the WinRM communicator for Windows targets. WinRM is supported for connecting to provisioned Windows VMs. ```hcl source "proxmox-iso" "winrm-example" { # ...config... communicator = "winrm" winrm_username = "Administrator" winrm_password = "P@ssw0rd" winrm_timeout = "20m" winrm_use_ssl = true winrm_insecure = true } ``` -------------------------------- ### Configure Proxmox RNG0 with HCL2 Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/rng0Config.mdx Use this HCL2 configuration block to set up a VirtIO Random Number Generator for a Proxmox VM. Specify the host device source, maximum bytes, and update period. ```hcl rng0 { source = "/dev/urandom" max_bytes = 1024 period = 1000 } ``` -------------------------------- ### Proxmox VM Serial Ports Configuration Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/Config-not-required.mdx Configure serial ports for a Proxmox VM. This can include passing through host serial devices or creating Unix sockets. Ensure the guest OS has the necessary drivers if using host devices. ```json [ "socket", "/dev/ttyS1" ] ``` -------------------------------- ### HCL2 PCI Device Passthrough Configuration Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/pciDeviceConfig.mdx Use this configuration to pass through a host PCI device into the VM. A minimal configuration requires either the `host` or the `mapping` key. Note that VMs with passed-through devices cannot be migrated. ```hcl pci_devices { host = "0000:0d:00.1" pcie = false device_id = "1003" legacy_igd = false mdev = "some-model" hide_rombar = false romfile = "vbios.bin" sub_device_id = "" sub_vendor_id = "" vendor_id = "15B3" x_vga = false } ``` -------------------------------- ### Proxmox Disk Configuration Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt Configures one or more virtual disks for a Proxmox VM. The `storage_pool` is mandatory for each disk. Default `disk_size` is 20G and `type` is `scsi`. For `io_thread = true`, `scsi_controller` must be `virtio-scsi-single`. ```hcl source "proxmox-iso" "disk-example" { # ...auth and node config... scsi_controller = "virtio-scsi-single" # Primary OS disk disks { type = "scsi" storage_pool = "local-lvm" disk_size = "40G" format = "raw" cache_mode = "none" asyncio = "io_uring" io_thread = true discard = true ssd = true exclude_from_backup = false } # Secondary data disk disks { type = "virtio" storage_pool = "ceph-pool" disk_size = "200G" format = "raw" cache_mode = "writeback" } } ``` -------------------------------- ### Configure TPM State Storage (JSON) Source: https://github.com/hashicorp/packer-plugin-proxmox/blob/main/docs-partials/builder/proxmox/common/tpmConfig.mdx This JSON object defines the TPM state storage pool and version. It is equivalent to the HCL2 configuration and can be used in environments that consume JSON for configuration. ```json "tpm_config": { "tpm_storage_pool": "local", "tpm_version": "v1.2" } ``` -------------------------------- ### Accessing Template ID in Post-Processor Source: https://context7.com/hashicorp/packer-plugin-proxmox/llms.txt The artifact ID, which is the Proxmox VMID, can be accessed using artifact.Id() in post-processors or downstream pipelines. ```hcl build { sources = ["source.proxmox-iso.fedora"] # Post-processor: write template ID to a manifest file post-processor "manifest" { output = "manifest.json" strip_path = true } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.