github.com/daniellockard/packer@v0.7.6-0.20141210173435-5a9390934716/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 ### Required: 48 49 * `source_path` (string) - Path to the source VMX file to clone. 50 51 * `ssh_username` (string) - The username to use to SSH into the machine 52 once the OS is installed. 53 54 ### Optional: 55 56 * `boot_command` (array of strings) - This is an array of commands to type 57 when the virtual machine is firsted booted. The goal of these commands should 58 be to type just enough to initialize the operating system installer. Special 59 keys can be typed as well, and are covered in the section below on the boot 60 command. If this is not specified, it is assumed the installer will start 61 itself. 62 63 * `boot_wait` (string) - The time to wait after booting the initial virtual 64 machine before typing the `boot_command`. The value of this should be 65 a duration. Examples are "5s" and "1m30s" which will cause Packer to wait 66 five seconds and one minute 30 seconds, respectively. If this isn't specified, 67 the default is 10 seconds. 68 69 * `floppy_files` (array of strings) - A list of files to place onto a floppy 70 disk that is attached when the VM is booted. This is most useful 71 for unattended Windows installs, which look for an `Autounattend.xml` file 72 on removable media. By default, no floppy will be attached. All files 73 listed in this setting get placed into the root directory of the floppy 74 and the floppy is attached as the first floppy device. Currently, no 75 support exists for creating sub-directories on the floppy. Wildcard 76 characters (*, ?, and []) are allowed. Directory names are also allowed, 77 which will add all the files found in the directory to the floppy. 78 79 * `fusion_app_path` (string) - Path to "VMware Fusion.app". By default this 80 is "/Applications/VMware Fusion.app" but this setting allows you to 81 customize this. 82 83 * `headless` (boolean) - Packer defaults to building VMware 84 virtual machines by launching a GUI that shows the console of the 85 machine being built. When this value is set to true, the machine will 86 start without a console. For VMware machines, Packer will output VNC 87 connection information in case you need to connect to the console to 88 debug the build process. 89 90 * `http_directory` (string) - Path to a directory to serve using an HTTP 91 server. The files in this directory will be available over HTTP that will 92 be requestable from the virtual machine. This is useful for hosting 93 kickstart files and so on. By default this is "", which means no HTTP 94 server will be started. The address and port of the HTTP server will be 95 available as variables in `boot_command`. This is covered in more detail 96 below. 97 98 * `http_port_min` and `http_port_max` (integer) - These are the minimum and 99 maximum port to use for the HTTP server started to serve the `http_directory`. 100 Because Packer often runs in parallel, Packer will choose a randomly available 101 port in this range to run the HTTP server. If you want to force the HTTP 102 server to be on one port, make this minimum and maximum port the same. 103 By default the values are 8000 and 9000, respectively. 104 105 * `output_directory` (string) - This is the path to the directory where the 106 resulting virtual machine will be created. This may be relative or absolute. 107 If relative, the path is relative to the working directory when `packer` 108 is executed. This directory must not exist or be empty prior to running the builder. 109 By default this is "output-BUILDNAME" where "BUILDNAME" is the name 110 of the build. 111 112 * `shutdown_command` (string) - The command to use to gracefully shut down 113 the machine once all the provisioning is done. By default this is an empty 114 string, which tells Packer to just forcefully shut down the machine. 115 116 * `shutdown_timeout` (string) - The amount of time to wait after executing 117 the `shutdown_command` for the virtual machine to actually shut down. 118 If it doesn't shut down in this time, it is an error. By default, the timeout 119 is "5m", or five minutes. 120 121 * `skip_compaction` (boolean) - VMware-created disks are defragmented 122 and compacted at the end of the build process using `vmware-vdiskmanager`. 123 In certain rare cases, this might actually end up making the resulting disks 124 slightly larger. If you find this to be the case, you can disable compaction 125 using this configuration value. 126 127 * `ssh_key_path` (string) - Path to a private key to use for authenticating 128 with SSH. By default this is not set (key-based auth won't be used). 129 The associated public key is expected to already be configured on the 130 VM being prepared by some other process (kickstart, etc.). 131 132 * `ssh_password` (string) - The password for `ssh_username` to use to 133 authenticate with SSH. By default this is the empty string. 134 135 * `ssh_port` (integer) - The port that SSH will listen on within the virtual 136 machine. By default this is 22. 137 138 * `ssh_skip_request_pty` (boolean) - If true, a pty will not be requested as 139 part of the SSH connection. By default, this is "false", so a pty 140 _will_ be requested. 141 142 * `ssh_wait_timeout` (string) - The duration to wait for SSH to become 143 available. By default this is "20m", or 20 minutes. Note that this should 144 be quite long since the timer begins as soon as the virtual machine is booted. 145 146 * `vm_name` (string) - This is the name of the VMX file for the new virtual 147 machine, without the file extension. By default this is "packer-BUILDNAME", 148 where "BUILDNAME" is the name of the build. 149 150 * `vmx_data` (object of key/value strings) - Arbitrary key/values 151 to enter into the virtual machine VMX file. This is for advanced users 152 who want to set properties such as memory, CPU, etc. 153 154 * `vmx_data_post` (object of key/value strings) - Identical to `vmx_data`, 155 except that it is run after the virtual machine is shutdown, and before the 156 virtual machine is exported. 157 158 * `vnc_port_min` and `vnc_port_max` (integer) - The minimum and maximum port to 159 use for VNC access to the virtual machine. The builder uses VNC to type 160 the initial `boot_command`. Because Packer generally runs in parallel, Packer 161 uses a randomly chosen port in this range that appears available. By default 162 this is 5900 to 6000. The minimum and maximum ports are inclusive.