github.com/kikitux/packer@v0.10.1-0.20160322154024-6237df566f9f/website/source/docs/builders/vmware-vmx.html.md (about) 1 --- 2 description: | 3 This VMware Packer builder is able to create VMware virtual machines from an 4 existing VMware virtual machine (a VMX file). It currently supports building 5 virtual machines on hosts running VMware Fusion Professional for OS X, VMware 6 Workstation for Linux and Windows, and VMware Player on Linux. 7 layout: docs 8 page_title: VMware Builder from VMX 9 ... 10 11 # VMware Builder (from VMX) 12 13 Type: `vmware-vmx` 14 15 This VMware Packer builder is able to create VMware virtual machines from an 16 existing VMware virtual machine (a VMX file). It currently supports building 17 virtual machines on hosts running [VMware Fusion 18 Professional](https://www.vmware.com/products/fusion-professional/) for OS X, 19 [VMware Workstation](https://www.vmware.com/products/workstation/overview.html) 20 for Linux and Windows, and [VMware 21 Player](https://www.vmware.com/products/player/) on Linux. 22 23 The builder builds a virtual machine by cloning the VMX file using the clone 24 capabilities introduced in VMware Fusion Professional 6, Workstation 10, and 25 Player 6. After cloning the VM, it provisions software within the new machine, 26 shuts it down, and compacts the disks. The resulting folder contains a new 27 VMware virtual machine. 28 29 ## Basic Example 30 31 Here is an example. This example is fully functional as long as the source path 32 points to a real VMX file with the proper settings: 33 34 ``` {.javascript} 35 { 36 "type": "vmware-vmx", 37 "source_path": "/path/to/a/vm.vmx", 38 "ssh_username": "root", 39 "ssh_password": "root", 40 "shutdown_command": "shutdown -P now" 41 } 42 ``` 43 44 ## Configuration Reference 45 46 There are many configuration options available for the VMware builder. They are 47 organized below into two categories: required and optional. Within each 48 category, the available options are alphabetized and described. 49 50 In addition to the options listed here, a 51 [communicator](/docs/templates/communicator.html) can be configured for this 52 builder. 53 54 ### Required: 55 56 - `source_path` (string) - Path to the source VMX file to clone. 57 58 - `ssh_username` (string) - The username to use to SSH into the machine once 59 the OS is installed. 60 61 ### Optional: 62 63 - `boot_command` (array of strings) - This is an array of commands to type 64 when the virtual machine is first booted. The goal of these commands should 65 be to type just enough to initialize the operating system installer. Special 66 keys can be typed as well, and are covered in the section below on the 67 boot command. If this is not specified, it is assumed the installer will 68 start itself. 69 70 - `boot_wait` (string) - The time to wait after booting the initial virtual 71 machine before typing the `boot_command`. The value of this should be 72 a duration. Examples are "5s" and "1m30s" which will cause Packer to wait 73 five seconds and one minute 30 seconds, respectively. If this isn't 74 specified, the default is 10 seconds. 75 76 - `floppy_files` (array of strings) - A list of files to place onto a floppy 77 disk that is attached when the VM is booted. This is most useful for 78 unattended Windows installs, which look for an `Autounattend.xml` file on 79 removable media. By default, no floppy will be attached. All files listed in 80 this setting get placed into the root directory of the floppy and the floppy 81 is attached as the first floppy device. Currently, no support exists for 82 creating sub-directories on the floppy. Wildcard characters (\*, ?, 83 and \[\]) are allowed. Directory names are also allowed, which will add all 84 the files found in the directory to the floppy. 85 86 - `fusion_app_path` (string) - Path to "VMware Fusion.app". By default this is 87 "/Applications/VMware Fusion.app" but this setting allows you to 88 customize this. 89 90 - `headless` (boolean) - Packer defaults to building VMware virtual machines 91 by launching a GUI that shows the console of the machine being built. When 92 this value is set to true, the machine will start without a console. For 93 VMware machines, Packer will output VNC connection information in case you 94 need to connect to the console to debug the build process. 95 96 - `http_directory` (string) - Path to a directory to serve using an 97 HTTP server. The files in this directory will be available over HTTP that 98 will be requestable from the virtual machine. This is useful for hosting 99 kickstart files and so on. By default this is "", which means no HTTP server 100 will be started. The address and port of the HTTP server will be available 101 as variables in `boot_command`. This is covered in more detail below. 102 103 - `http_port_min` and `http_port_max` (integer) - These are the minimum and 104 maximum port to use for the HTTP server started to serve the 105 `http_directory`. Because Packer often runs in parallel, Packer will choose 106 a randomly available port in this range to run the HTTP server. If you want 107 to force the HTTP server to be on one port, make this minimum and maximum 108 port the same. By default the values are 8000 and 9000, respectively. 109 110 - `output_directory` (string) - This is the path to the directory where the 111 resulting virtual machine will be created. This may be relative or absolute. 112 If relative, the path is relative to the working directory when `packer` 113 is executed. This directory must not exist or be empty prior to running 114 the builder. By default this is "output-BUILDNAME" where "BUILDNAME" is the 115 name of the build. 116 117 - `shutdown_command` (string) - The command to use to gracefully shut down the 118 machine once all the provisioning is done. By default this is an empty 119 string, which tells Packer to just forcefully shut down the machine unless a 120 shutdown command takes place inside script so this may safely be omitted. If 121 one or more scripts require a reboot it is suggested to leave this blank 122 since reboots may fail and specify the final shutdown command in your 123 last script. 124 125 - `shutdown_timeout` (string) - The amount of time to wait after executing the 126 `shutdown_command` for the virtual machine to actually shut down. If it 127 doesn't shut down in this time, it is an error. By default, the timeout is 128 "5m", or five minutes. 129 130 - `skip_compaction` (boolean) - VMware-created disks are defragmented and 131 compacted at the end of the build process using `vmware-vdiskmanager`. In 132 certain rare cases, this might actually end up making the resulting disks 133 slightly larger. If you find this to be the case, you can disable compaction 134 using this configuration value. 135 136 - `vm_name` (string) - This is the name of the VMX file for the new virtual 137 machine, without the file extension. By default this is "packer-BUILDNAME", 138 where "BUILDNAME" is the name of the build. 139 140 - `vmx_data` (object of key/value strings) - Arbitrary key/values to enter 141 into the virtual machine VMX file. This is for advanced users who want to 142 set properties such as memory, CPU, etc. 143 144 - `vmx_data_post` (object of key/value strings) - Identical to `vmx_data`, 145 except that it is run after the virtual machine is shutdown, and before the 146 virtual machine is exported. 147 148 - `vnc_port_min` and `vnc_port_max` (integer) - The minimum and maximum port 149 to use for VNC access to the virtual machine. The builder uses VNC to type 150 the initial `boot_command`. Because Packer generally runs in parallel, 151 Packer uses a randomly chosen port in this range that appears available. By 152 default this is 5900 to 6000. The minimum and maximum ports are inclusive.