### Basic JSON Example for VMware ISO Builder Source: https://github.com/vmware/packer-plugin-vmware/blob/main/docs/builders/iso.mdx This JSON example shows the equivalent configuration to the HCL example for the VMware ISO builder. It specifies the builder type and essential parameters for creating a VM from an ISO. ```json { "type": "vmware-iso", "iso_url": "https://releases.ubuntu.com/yy.mm/ubuntu-yy.mm-live-server-amd64.iso", "iso_checksum": "sha256:8762f7e74e4d64d72fceb5f70682e6b069932deedb4949c6975d0f0fe0a91be3", "ssh_username": "packer", "ssh_password": "password", "shutdown_command": "shutdown -P now" } ``` -------------------------------- ### Basic HCL Example for VMware ISO Builder Source: https://github.com/vmware/packer-plugin-vmware/blob/main/docs/builders/iso.mdx This HCL example demonstrates the basic configuration for building a virtual machine from an ISO file. It includes essential parameters like the ISO URL, checksum, and SSH credentials for provisioning. ```hcl source "vmware-iso" "example" { iso_url = "https://releases.ubuntu.com/yy.mm/ubuntu-yy.mm-live-server-amd64.iso" iso_checksum = "sha256:8762f7e74e4d64d72fceb5f70682e6b069932deedb4949c6975d0f0fe0a91be3" ssh_username = "packer" ssh_password = "password" shutdown_command = "shutdown -P now" } build { sources = [ "source.vmware-iso.example" ] } ``` -------------------------------- ### Packer Initialization and Build Command Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Commands to initialize Packer plugins and build a VM. Use 'packer init .' to download required plugins and 'packer build' with a variable file to start the build process. ```shell packer init . packer build -var-file=pkrvars/debian/fusion-arm64-vmx.pkrvars.hcl . ``` -------------------------------- ### Install Packer Plugin Automatically Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Run `packer init` in your project directory after declaring the plugin requirement to download and install it. ```shell packer init . ``` -------------------------------- ### Install VMware Plugin with Packer Configuration Source: https://github.com/vmware/packer-plugin-vmware/blob/main/docs/README.md Add this configuration to your Packer file to specify the VMware plugin version and source. Run `packer init` to install. ```hcl packer { required_plugins { vmware = { version = "~> 2" source = "github.com/vmware/vmware" } } } ``` -------------------------------- ### Install VMware Plugin using Packer CLI Source: https://github.com/vmware/packer-plugin-vmware/blob/main/docs/README.md Use the `packer plugins install` command to directly install the VMware plugin. This is an alternative to managing plugins within your Packer configuration. ```sh packer plugins install github.com/vmware/vmware ``` -------------------------------- ### Install Packer Plugin Manually Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Manually install the latest release or a specific version of the vmware Packer plugin using the `packer plugins install` command. ```shell # Install the latest release packer plugins install github.com/vmware/vmware # Install a specific version packer plugins install github.com/vmware/vmware@v2.1.2 ``` -------------------------------- ### Configure Packer for Automatic Plugin Installation Source: https://github.com/vmware/packer-plugin-vmware/blob/main/README.md Include this block in your Packer configuration to automatically install the VMware plugin when running `packer init`. Ensure your Packer version and the plugin version meet the requirements. ```hcl packer { required_version = ">= 1.7.0" required_plugins { vmware = { version = ">= 2.1.2" source = "github.com/vmware/vmware" } } } ``` -------------------------------- ### Install Packer VMware Plugin (Specific Version) Source: https://github.com/vmware/packer-plugin-vmware/blob/main/README.md Install a specific version of the VMware plugin for Packer using this command. This is useful for ensuring compatibility with existing configurations or for testing specific releases. ```shell packer plugins install github.com/vmware/vmware@v2.1.2 ``` -------------------------------- ### Configure Local Output Directory for VM Artifact Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Sets the local directory where the virtual machine artifact will be written. This directory must not exist or must be empty before the build starts. ```hcl source "vmware-iso" "output-demo" { iso_url = "..." iso_checksum = "sha256:" ssh_username = "packer" ssh_password = "packer" shutdown_command = "sudo shutdown -P now" # Defaults to "output-" if not set output_directory = "builds/debian-12-amd64" } ``` -------------------------------- ### Specify VMware Fusion Application Path Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt If VMware Fusion is not installed in the default location, use `fusion_app_path` to specify the correct path. This setting is only needed for non-standard installations. ```hcl source "vmware-iso" "fusion-custom-path" { iso_url = "..." iso_checksum = "sha256:..." ssh_username = "packer" ssh_password = "packer" shutdown_command = "sudo shutdown -P now" # Only needed if Fusion is installed outside the default location fusion_app_path = "/Applications/VMware Fusion Tech Preview.app" } ``` -------------------------------- ### Initialize Packer and Build for VMware Workstation Pro Source: https://github.com/vmware/packer-plugin-vmware/blob/main/example/iso/README.md Initialize Packer and then build a virtual machine using VMware Workstation Pro. Requires a specific variable file for configuration. ```shell packer init . packer build -var-file=pkrvars/debian/workstation-amd64.pkrvars.hcl . ``` -------------------------------- ### Build VM from OVF - Fusion Pro (Intel) Source: https://github.com/vmware/packer-plugin-vmware/blob/main/example/vmx/README.md Initializes Packer and builds a VM from an OVF file using VMware Fusion Pro on Intel architecture. Requires a specific `.pkrvars.hcl` file for configuration. ```shell # or packer build -var-file=pkrvars/debian/fusion-amd64-ovf.pkrvars.hcl . ``` -------------------------------- ### Build VM from OVA - Fusion Pro (Intel) Source: https://github.com/vmware/packer-plugin-vmware/blob/main/example/vmx/README.md Initializes Packer and builds a VM from an OVA file using VMware Fusion Pro on Intel architecture. Requires a specific `.pkrvars.hcl` file for configuration. ```shell packer init . packer build -var-file=pkrvars/debian/fusion-amd64-ova.pkrvars.hcl . ``` -------------------------------- ### Initialize Packer and Build for VMware Fusion Pro (Intel) Source: https://github.com/vmware/packer-plugin-vmware/blob/main/example/iso/README.md Initialize Packer and then build a virtual machine using VMware Fusion Pro on an Intel architecture. Requires a specific variable file for configuration. ```shell packer init . packer build -var-file=pkrvars/debian/fusion-amd64.pkrvars.hcl . ``` -------------------------------- ### Build VM from OVA - Workstation Pro Source: https://github.com/vmware/packer-plugin-vmware/blob/main/example/vmx/README.md Initializes Packer and builds a VM from an OVA file using VMware Workstation Pro. Requires a specific `.pkrvars.hcl` file for configuration. ```shell packer init . packer build -var-file=pkrvars/debian/workstation-amd64-ova.pkrvars.hcl . ``` -------------------------------- ### Initialize Packer and Build for VMware Fusion Pro (Apple Silicon) Source: https://github.com/vmware/packer-plugin-vmware/blob/main/example/iso/README.md Initialize Packer and then build a virtual machine using VMware Fusion Pro on an Apple Silicon architecture. Requires a specific variable file for configuration. ```shell packer init . packer build -var-file=pkrvars/debian/fusion-arm64.pkrvars.hcl . ``` -------------------------------- ### Build VM from OVF - Workstation Pro Source: https://github.com/vmware/packer-plugin-vmware/blob/main/example/vmx/README.md Initializes Packer and builds a VM from an OVF file using VMware Workstation Pro. Requires a specific `.pkrvars.hcl` file for configuration. ```shell # or packer build -var-file=pkrvars/debian/workstation-amd64-ovf.pkrvars.hcl . ``` -------------------------------- ### Build VM from VMX - Fusion Pro (Intel) Source: https://github.com/vmware/packer-plugin-vmware/blob/main/example/vmx/README.md Initializes Packer and builds a VM from a VMX file using VMware Fusion Pro on Intel architecture. Requires a specific `.pkrvars.hcl` file for configuration. ```shell packer init . packer build -var-file=pkrvars/debian/fusion-amd64-vmx.pkrvars.hcl . ``` -------------------------------- ### Build VM from OVA - Fusion Pro (Apple Silicon) Source: https://github.com/vmware/packer-plugin-vmware/blob/main/example/vmx/README.md Initializes Packer and builds a VM from an OVA file using VMware Fusion Pro on Apple Silicon. Requires a specific `.pkrvars.hcl` file for configuration. ```shell packer init . packer build -var-file=pkrvars/debian/fusion-arm64-ova.pkrvars.hcl . ``` -------------------------------- ### Configure Headless Mode and VNC Access Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Enable `headless = true` to run the hypervisor without a GUI. Configure VNC settings for boot command keystrokes using `vnc_bind_address`, `vnc_port_min`, and `vnc_port_max`. ```hcl source "vmware-iso" "headless-vnc" { iso_url = "..." iso_checksum = "sha256:..." ssh_username = "packer" ssh_password = "packer" shutdown_command = "sudo shutdown -P now" # Run without the hypervisor GUI window headless = true # VNC settings (used to send boot_command keystrokes) vnc_bind_address = "0.0.0.0" # bind to all interfaces vnc_port_min = 5900 vnc_port_max = 6000 vnc_disable_password = false # auto-generate VNC password (default) } ``` -------------------------------- ### Build VM from VMX - Workstation Pro Source: https://github.com/vmware/packer-plugin-vmware/blob/main/example/vmx/README.md Initializes Packer and builds a VM from a VMX file using VMware Workstation Pro. Requires a specific `.pkrvars.hcl` file for configuration. ```shell packer init . packer build -var-file=pkrvars/debian/workstation-amd64-vmx.pkrvars.hcl . ``` -------------------------------- ### Configure vmware-iso Builder for Debian Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Configure the `vmware-iso` builder to create a Debian VM from an ISO. This includes ISO details, VM identity, hardware settings, disk configuration, HTTP server for preseed, VNC boot commands, communicator settings, and output format. ```hcl # build.pkr.hcl packer { required_version = ">= 1.7.0" required_plugins { vmware = { version = ">= 2.0.0" source = "github.com/vmware/vmware" } } } source "vmware-iso" "debian" { # --- ISO --- iso_url = "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.5.0-amd64-netinst.iso" iso_checksum = "sha256:013f5b44670d81280b5b1bc02455842b250df2f0c6763398feb69af1a805a14f" # --- VM identity --- vm_name = "debian-12-amd64" guest_os_type = "debian-64" version = 21 # virtual hardware version (min 19) # --- Hardware --- cpus = 2 memory = 2048 firmware = "efi" network_adapter_type = "e1000e" network = "nat" disk_adapter_type = "sata" cdrom_adapter_type = "sata" # --- Disk --- disk_size = 20480 # MB (~20 GB), expandable sparse # --- HTTP server for preseed --- http_directory = "http" # serve files from ./http/ # --- Boot sequence (VNC) --- boot_wait = "10s" boot_command = [ "", "/install/vmlinuz initrd=/install/initrd.gz ", "auto-install/enable=true debconf/priority=critical ", "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg" ] # --- Communicator --- ssh_username = "packer" ssh_password = "packer" ssh_timeout = "30m" # --- Shutdown --- shutdown_command = "echo 'packer' | sudo -S shutdown -P now" # --- Output --- output_directory = "builds/debian-12-amd64" format = "ovf" # vmx (default), ovf, or ova } build { sources = ["source.vmware-iso.debian"] provisioner "shell" { inline = [ "sudo apt-get update -y", "sudo apt-get install -y open-vm-tools" ] } } ``` -------------------------------- ### Build VMware Images with Packer Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Commands to initialize Packer and build VM images for different VMware platforms using specified variable files. ```shell # Build for VMware Fusion Pro on Apple Silicon packer init . && packer build -var-file=pkrvars/debian/fusion-arm64.pkrvars.hcl . ``` ```shell # Build for VMware Workstation Pro on Linux/Windows packer init . && packer build -var-file=pkrvars/debian/workstation-amd64.pkrvars.hcl . ``` -------------------------------- ### Parse, Encode, Read, and Write VMX Files in Go Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Demonstrates the usage of ParseVMX, EncodeVMX, WriteVMX, and ReadVMX functions for manipulating VMX file content programmatically. Ensure the common package is imported. ```go package main import ( "fmt" "log" vmwcommon "github.com/vmware/packer-plugin-vmware/builder/vmware/common" ) func main() { // --- ParseVMX: parse raw VMX text into a map --- raw := ` .encoding = "UTF-8" displayname = "debian-12" memsize = "2048" numvcpus = "2" guestOS = "debian-64" ` data := vmwcommon.ParseVMX(raw) fmt.Println(data["displayname"]) // keys are lowercased: "debian-12" fmt.Println(data["memsize"]) // "2048" // --- Modify the map --- data["memsize"] = "4096" data["annotation"] = "Built by Packer" // --- EncodeVMX: serialize map back to VMX text (keys sorted) --- encoded := vmwcommon.EncodeVMX(data) fmt.Println(encoded) // annotation = "Built by Packer" // displayName = "debian-12" // guestOS = "debian-64" // memsize = "4096" // numvcpus = "2" // --- WriteVMX: write map to a .vmx file --- if err := vmwcommon.WriteVMX("/tmp/test.vmx", data); err != nil { log.Fatalf("WriteVMX failed: %v", err) } // --- ReadVMX: read a .vmx file back into a map --- loaded, err := vmwcommon.ReadVMX("/tmp/test.vmx") if err != nil { log.Fatalf("ReadVMX failed: %v", err) } fmt.Println(loaded["memsize"]) // "4096" } ``` -------------------------------- ### Basic VMX Builder Configuration in JSON Source: https://github.com/vmware/packer-plugin-vmware/blob/main/docs/builders/vmx.mdx This JSON configuration defines the source for the VMX builder, specifying the path to the existing .vmx file and SSH credentials for provisioners. ```json { "type": "vmware-vmx", "source_path": "/path/to/example.vmx", "ssh_username": "packer", "ssh_password": "password", "shutdown_command": "shutdown -P now" } ``` -------------------------------- ### Run Packer Build Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Execute the Packer build process using `packer build .`. You can also override variables during the build using the `-var` flag. ```shell # Run the build packer build . # Build with variable overrides packer build -var 'vm_name=debian-custom' -var 'memory=4096' . ``` -------------------------------- ### Configure VMware Tools Upload Mode Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Set `tools_mode` to `upload` to use the hypervisor's built-in ISO. Specify the `tools_upload_flavor` and `tools_upload_path` for the guest OS. ```hcl source "vmware-iso" "tools-upload" { iso_url = "..." iso_checksum = "sha256:..." ssh_username = "packer" ssh_password = "packer" shutdown_command = "sudo shutdown -P now" # Mode 1: upload using hypervisor's built-in tools ISO for the given flavor tools_mode = "upload" tools_upload_flavor = "linux" # darwin | linux | windows tools_upload_path = "/tmp/{{ .Flavor }}.iso" # destination path in guest } ``` -------------------------------- ### Decode and Use SSH Public Key in Kickstart Source: https://github.com/vmware/packer-plugin-vmware/blob/main/docs-partials/builder/vmware/SshKeyPairAutomation.mdx A kickstart script snippet that decodes a URL-encoded SSH public key from the kernel command line and adds it to the authorized_keys file for a specified user. ```shell %post # Newly created users need the file/folder framework for SSH key authentication. umask 0077 mkdir /etc/skel/.ssh touch /etc/skel/.ssh/authorized_keys # Loop over the command line. Set interesting variables. for x in $(cat /proc/cmdline) do case $x in PACKER_USER=*) PACKER_USER="${x#*=}" ;; PACKER_AUTHORIZED_KEY=*) # URL decode $encoded into $PACKER_AUTHORIZED_KEY encoded=$(echo "${x#*=}" | tr '+' ' ') printf -v PACKER_AUTHORIZED_KEY '%b' "${encoded//%/\\x}" ;; esac done # Create/configure packer user, if any. if [ -n "$PACKER_USER" ] then useradd $PACKER_USER echo "%${PACKER_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/$PACKER_USER [ -n "$PACKER_AUTHORIZED_KEY" ] && echo $PACKER_AUTHORIZED_KEY >> $(eval echo ~"$PACKER_USER")/.ssh/authorized_keys fi %end ``` -------------------------------- ### Inject SSH Public Key into Boot Command (JSON) Source: https://github.com/vmware/packer-plugin-vmware/blob/main/docs-partials/builder/vmware/SshKeyPairAutomation.mdx Use the `SSHPublicKey` template engine, optionally URL-encoded, to pass the SSH public key to the boot command in JSON format. ```json "boot_command": [ " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg PACKER_USER={{ user `username` }} PACKER_AUTHORIZED_KEY={{ .SSHPublicKey | urlquery }}" ] ``` -------------------------------- ### Inject SSH Public Key into Boot Command (HCL) Source: https://github.com/vmware/packer-plugin-vmware/blob/main/docs-partials/builder/vmware/SshKeyPairAutomation.mdx Use the `SSHPublicKey` template engine, optionally URL-encoded, to pass the SSH public key to the boot command in HCL format. ```hcl boot_command = [ " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg PACKER_USER={{ user `username` }} PACKER_AUTHORIZED_KEY={{ .SSHPublicKey | urlquery }}" ] ``` -------------------------------- ### Configure VMware Tools Attach Mode Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Use `tools_mode` set to `attach` to mount a local VMware Tools ISO as a CD-ROM device. The ISO will be removed after the build. ```hcl source "vmware-iso" "tools-attach" { iso_url = "..." iso_checksum = "sha256:..." ssh_username = "packer" ssh_password = "packer" shutdown_command = "sudo shutdown -P now" # Mode 2: attach a local ISO as a CD-ROM (removed after build) tools_mode = "attach" tools_source_path = "/path/to/VMwareTools-12.4.0.iso" } ``` -------------------------------- ### Define VMware Fusion ARM64 Variables Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Configuration variables for building a Debian ARM64 image on VMware Fusion for Apple Silicon. ```hcl iso_url = "https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-12.5.0-arm64-netinst.iso" iso_checksum = "sha256:" vm_name = "debian-12-arm64" cdrom_adapter_type = "sata" disk_adapter_type = "sata" network_adapter_type = "e1000e" guest_os_type = "arm-debian-64" ``` -------------------------------- ### Basic VMX Builder Configuration in HCL Source: https://github.com/vmware/packer-plugin-vmware/blob/main/docs/builders/vmx.mdx This HCL configuration defines the source for the VMX builder, specifying the path to the existing .vmx file and SSH credentials for provisioners. ```hcl source "vmware-vmx" "example" { source_path = "/path/to/example.vmx" ssh_username = "packer" ssh_password = "password" shutdown_command = "shutdown -P now" } build { sources = [ "source.vmware-vmx.example" ] } ``` -------------------------------- ### Inject VMX Configuration Data Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Use `vmx_data` to inject or override VMX properties before boot and `vmx_data_post` for settings applied after provisioning. This is useful for configurations not directly exposed by the plugin. ```hcl source "vmware-iso" "vmx-demo" { iso_url = "..." iso_checksum = "sha256:..." ssh_username = "packer" ssh_password = "packer" shutdown_command = "sudo shutdown -P now" # Set before VM boots vmx_data = { "cpuid.coresPerSocket" = "2" "vhv.enable" = "TRUE" # nested virtualization "tools.syncTime" = "FALSE" "scsi0:0.ioSize" = "0" } # Set after provisioning completes (applied to the artifact) vmx_data_post = { "tools.syncTime" = "TRUE" "annotation" = "Built by Packer on ${formatdate("YYYY-MM-DD", timestamp())}" } # Remove all ethernet adapters from the final artifact (useful for Vagrant boxes) vmx_remove_ethernet_interfaces = true # Override the inventory display name display_name = "Debian 12 Golden Image" } ``` -------------------------------- ### VMware OVA Source Configuration Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Configure a VMware builder to clone from an OVA file. Requires specifying the source OVA path, guest OS type, and version. SSH credentials and shutdown command are also necessary. ```hcl source "vmware-vmx" "from-ova" { source_path = "/path/to/base.ova" guest_os_type = "debian-64" # required for OVA/OVF sources version = 21 ssh_username = "packer" ssh_password = "packer" ssh_timeout = "15m" shutdown_command = "sudo shutdown -P now" } ``` -------------------------------- ### Packer Template for Parameterized Debian ISO Build Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt A complete Packer template demonstrating how to parameterize a Debian build for multiple hypervisors and architectures using variable files. It separates configuration into distinct files. ```hcl # variables.pkr.hcl variable "iso_url" { type = string } variable "iso_checksum" { type = string } variable "vm_name" { type = string default = "debian-12" } variable "cpus" { type = number default = 2 } variable "memory" { type = number default = 2048 } variable "disk_size" { type = number default = 20480 } variable "headless" { type = bool default = false } variable "guest_os_type" { type = string default = "debian-64" } variable "cdrom_adapter_type" { type = string default = "sata" } variable "disk_adapter_type" { type = string default = "sata" } variable "network_adapter_type" { type = string default = "e1000e" } variable "output_directory" { type = string default = null } # sources.pkr.hcl locals { output_dir = var.output_directory == null ? "builds/${var.vm_name}" : var.output_directory } source "vmware-iso" "debian" { vm_name = var.vm_name headless = var.headless guest_os_type = var.guest_os_type cpus = var.cpus memory = var.memory disk_size = var.disk_size cdrom_adapter_type = var.cdrom_adapter_type disk_adapter_type = var.disk_adapter_type network_adapter_type = var.network_adapter_type iso_url = var.iso_url iso_checksum = var.iso_checksum http_directory = "data" boot_wait = "10s" boot_command = [ "", "/install/vmlinuz initrd=/install/initrd.gz ", "auto-install/enable=true debconf/priority=critical ", "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg" ] ssh_username = "packer" ssh_password = "packer" ssh_timeout = "60m" output_directory = local.output_dir shutdown_command = "echo 'packer' | sudo -S shutdown -P now" format = "ovf" } # build.pkr.hcl packer { required_plugins { vmware = { version = ">= 2.0.0" source = "github.com/vmware/vmware" } } } build { sources = ["source.vmware-iso.debian"] provisioner "shell" { inline = [ "sudo apt-get update -y", "sudo apt-get install -y open-vm-tools curl wget" ] } } ``` -------------------------------- ### VMware ISO Builder Hardware Configuration Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Configure hardware resources for a VMware ISO builder. This includes CPU, memory, network adapter type, firmware, USB settings, and sound card. Serial and parallel ports can also be configured. ```hcl source "vmware-iso" "full-hw" { iso_url = "..." iso_checksum = "sha256:..." ssh_username = "packer" ssh_password = "packer" shutdown_command = "sudo shutdown -P now" # Firmware: bios | efi | efi-secure firmware = "efi-secure" # CPU cpus = 4 # total virtual CPUs cores = 2 # cores per socket (2 sockets × 2 cores = 4 vCPUs) # Memory (MB) memory = 8192 # Network network = "nat" # nat | hostonly | bridged | custom network_adapter_type = "vmxnet3" # vmxnet3 | e1000e | e1000 # USB usb = true usb_version = "3.1" # 2.0 | 3.1 | 3.2 # Sound card sound = false # Serial port via named pipe (client VM end, app host end) serial = "PIPE:/tmp/serial.pipe,client,app" # Parallel port (auto-detect, bidirectional) parallel = "AUTO:BI" } ``` -------------------------------- ### VMware VMX Source Configuration Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Configure a VMware builder to clone from a .vmx file. Specify source path, VM name, clone type, SSH credentials, and output directory. Optional settings include guest OS type, version, and snapshot name. ```hcl source "vmware-vmx" "debian" { source_path = "/path/to/base/debian-12.vmx" # required; also accepts .ova / .ovf vm_name = "debian-12-custom" linked = false # true = linked clone (smaller, depends on parent) headless = true skip_compaction = false # guest_os_type and version are optional for .vmx sources; # required for .ova/.ovf sources # guest_os_type = "debian-64" # version = 21 snapshot_name = "provisioned" # create snapshot after build; omit to skip ssh_username = "packer" ssh_password = "packer" ssh_timeout = "15m" output_directory = "builds/debian-12-custom" shutdown_command = "echo 'packer' | sudo -S shutdown -P now" # Inject/override arbitrary VMX keys before boot vmx_data = { "memsize" = "4096" "numvcpus" = "4" } format = "ova" } ``` -------------------------------- ### VMware ISO Builder Disk Configuration Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Configure primary disk size, disk type, and adapter for a VMware ISO builder. Additional data disks can also be specified with their sizes. The VMDK base filename can be customized. ```hcl source "vmware-iso" "disk-demo" { iso_url = "..." iso_checksum = "sha256:..." ssh_username = "packer" ssh_password = "packer" shutdown_command = "sudo shutdown -P now" # Primary disk size (ISO builder only), in MB disk_size = 51200 # ~50 GB # Disk type: 0=monolithic sparse, 1=split sparse (default), # 2=monolithic flat, 3=split flat, # 4=VMFS flat, 5=compressed stream disk_type_id = "0" # Adapter: ide | sata | nvme | scsi (default lsilogic) disk_adapter_type = "sata" # VMDK base filename (without extension), defaults to "disk" vmdk_name = "my-disk" # Additional data disks (sizes in MB) disk_additional_size = [10240, 20480] } ``` -------------------------------- ### VMware ISO Builder Export Configuration Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Configure export settings for a VMware ISO builder, including output format (vmx, ovf, ova) and OVF Tool options. Compaction and export steps can be skipped. ```hcl source "vmware-iso" "export-demo" { iso_url = "..." iso_checksum = "sha256:..." ssh_username = "packer" ssh_password = "packer" shutdown_command = "sudo shutdown -P now" # Output format: vmx (default, skips export), ovf, or ova format = "ova" # Pass extra arguments directly to ovftool ovftool_options = [ "--compress=9", "--shaAlgorithm=SHA256" ] # Skip disk compaction step (useful for pre-allocated disk types) skip_compaction = false # Skip export entirely (e.g., artifact produced inside the VM) skip_export = false } ``` -------------------------------- ### Configure VMware Tools Disabled Mode Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Set `tools_mode` to `disable` to prevent VMware Tools from being provided to the guest operating system during the build process. ```hcl source "vmware-iso" "tools-disabled" { iso_url = "..." iso_checksum = "sha256:..." ssh_username = "packer" ssh_password = "packer" shutdown_command = "sudo shutdown -P now" # Mode 3: don't provide VMware Tools at all tools_mode = "disable" } ``` -------------------------------- ### Set VMware Fusion Application Path via Environment Variable Source: https://context7.com/vmware/packer-plugin-vmware/llms.txt Alternatively, the `FUSION_APP_PATH` environment variable can be used to specify the VMware Fusion application path before running the `packer build` command. ```shell export FUSION_APP_PATH="/Applications/VMware Fusion Tech Preview.app" packer build . ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.