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