github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/website/source/docs/builders/parallels-pvm.html.md (about) 1 --- 2 description: | 3 This Parallels builder is able to create Parallels Desktop for Mac virtual 4 machines and export them in the PVM format, starting from an existing PVM 5 (exported virtual machine image). 6 layout: docs 7 page_title: 'Parallels PVM - Builders' 8 sidebar_current: 'docs-builders-parallels-pvm' 9 --- 10 11 # Parallels Builder (from a PVM) 12 13 Type: `parallels-pvm` 14 15 This Parallels builder is able to create [Parallels Desktop for 16 Mac](https://www.parallels.com/products/desktop/) virtual machines and export 17 them in the PVM format, starting from an existing PVM (exported virtual machine 18 image). 19 20 The builder builds a virtual machine by importing an existing PVM file. It then 21 boots this image, runs provisioners on this new VM, and exports that VM to 22 create the image. The imported machine is deleted prior to finishing the build. 23 24 ## Basic Example 25 26 Here is a basic example. This example is functional if you have an PVM matching 27 the settings here. 28 29 ``` json 30 { 31 "type": "parallels-pvm", 32 "parallels_tools_flavor": "lin", 33 "source_path": "source.pvm", 34 "ssh_username": "packer", 35 "ssh_password": "packer", 36 "ssh_wait_timeout": "30s", 37 "shutdown_command": "echo 'packer' | sudo -S shutdown -P now" 38 } 39 ``` 40 41 It is important to add a `shutdown_command`. By default Packer halts the virtual 42 machine and the file system may not be sync'd. Thus, changes made in a 43 provisioner might not be saved. 44 45 ## Configuration Reference 46 47 There are many configuration options available for the Parallels builder. They 48 are organized below into two categories: required and optional. Within each 49 category, the available options are alphabetized and described. 50 51 In addition to the options listed here, a 52 [communicator](/docs/templates/communicator.html) can be configured for this 53 builder. 54 55 ### Required: 56 57 - `parallels_tools_flavor` (string) - The flavor of the Parallels Tools ISO to 58 install into the VM. Valid values are "win", "lin", "mac", "os2" 59 and "other". This can be omitted only if `parallels_tools_mode` 60 is "disable". 61 62 - `source_path` (string) - The path to a PVM directory that acts as the source 63 of this build. 64 65 ### Optional: 66 67 - `boot_command` (array of strings) - This is an array of commands to type 68 when the virtual machine is first booted. The goal of these commands should 69 be to type just enough to initialize the operating system installer. Special 70 keys can be typed as well, and are covered in the section below on the 71 boot command. If this is not specified, it is assumed the installer will 72 start itself. 73 74 - `boot_wait` (string) - The time to wait after booting the initial virtual 75 machine before typing the `boot_command`. The value of this should be 76 a duration. Examples are "5s" and "1m30s" which will cause Packer to wait 77 five seconds and one minute 30 seconds, respectively. If this isn't 78 specified, the default is 10 seconds. 79 80 - `floppy_files` (array of strings) - A list of files to place onto a floppy 81 disk that is attached when the VM is booted. This is most useful for 82 unattended Windows installs, which look for an `Autounattend.xml` file on 83 removable media. By default, no floppy will be attached. All files listed in 84 this setting get placed into the root directory of the floppy and the floppy 85 is attached as the first floppy device. Currently, no support exists for 86 creating sub-directories on the floppy. Wildcard characters (\*, ?, 87 and \[\]) are allowed. Directory names are also allowed, which will add all 88 the files found in the directory to the floppy. 89 90 - `floppy_dirs` (array of strings) - A list of directories to place onto 91 the floppy disk recursively. This is similar to the `floppy_files` option 92 except that the directory structure is preserved. This is useful for when 93 your floppy disk includes drivers or if you just want to organize it's 94 contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed. 95 96 - `output_directory` (string) - This is the path to the directory where the 97 resulting virtual machine will be created. This may be relative or absolute. 98 If relative, the path is relative to the working directory when `packer` 99 is executed. This directory must not exist or be empty prior to running 100 the builder. By default this is "output-BUILDNAME" where "BUILDNAME" is the 101 name of the build. 102 103 - `parallels_tools_guest_path` (string) - The path in the VM to upload 104 Parallels Tools. This only takes effect if `parallels_tools_mode` 105 is "upload". This is a [configuration 106 template](/docs/templates/engine.html) that has a single 107 valid variable: `Flavor`, which will be the value of 108 `parallels_tools_flavor`. By default this is "prl-tools-{{.Flavor}}.iso" 109 which should upload into the login directory of the user. 110 111 - `parallels_tools_mode` (string) - The method by which Parallels Tools are 112 made available to the guest for installation. Valid options are "upload", 113 "attach", or "disable". If the mode is "attach" the Parallels Tools ISO will 114 be attached as a CD device to the virtual machine. If the mode is "upload" 115 the Parallels Tools ISO will be uploaded to the path specified by 116 `parallels_tools_guest_path`. The default value is "upload". 117 118 - `prlctl` (array of array of strings) - Custom `prlctl` commands to execute 119 in order to further customize the virtual machine being created. The value 120 of this is an array of commands to execute. The commands are executed in the 121 order defined in the template. For each command, the command is defined 122 itself as an array of strings, where each string represents a single 123 argument on the command-line to `prlctl` (but excluding `prlctl` itself). 124 Each arg is treated as a [configuration 125 template](/docs/templates/engine.html), where the `Name` 126 variable is replaced with the VM name. More details on how to use `prlctl` 127 are below. 128 129 - `prlctl_post` (array of array of strings) - Identical to `prlctl`, except 130 that it is run after the virtual machine is shutdown, and before the virtual 131 machine is exported. 132 133 - `prlctl_version_file` (string) - The path within the virtual machine to 134 upload a file that contains the `prlctl` version that was used to create 135 the machine. This information can be useful for provisioning. By default 136 this is ".prlctl\_version", which will generally upload it into the 137 home directory. 138 139 - `reassign_mac` (boolean) - If this is "false" the MAC address of the first 140 NIC will reused when imported else a new MAC address will be generated 141 by Parallels. Defaults to "false". 142 143 - `shutdown_command` (string) - The command to use to gracefully shut down the 144 machine once all the provisioning is done. By default this is an empty 145 string, which tells Packer to just forcefully shut down the machine. 146 147 - `shutdown_timeout` (string) - The amount of time to wait after executing the 148 `shutdown_command` for the virtual machine to actually shut down. If it 149 doesn't shut down in this time, it is an error. By default, the timeout is 150 "5m", or five minutes. 151 152 - `skip_compaction` (boolean) - Virtual disk image is compacted at the end of 153 the build process using `prl_disk_tool` utility. In certain rare cases, this 154 might corrupt the resulting disk image. If you find this to be the case, 155 you can disable compaction using this configuration value. 156 157 - `vm_name` (string) - This is the name of the virtual machine when it is 158 imported as well as the name of the PVM directory when the virtual machine 159 is exported. By default this is "packer-BUILDNAME", where "BUILDNAME" is the 160 name of the build. 161 162 ## Parallels Tools 163 164 After the virtual machine is up and the operating system is installed, Packer 165 uploads the Parallels Tools into the virtual machine. The path where they are 166 uploaded is controllable by `parallels_tools_path`, and defaults to 167 "prl-tools.iso". Without an absolute path, it is uploaded to the home directory 168 of the SSH user. Parallels Tools ISO's can be found in: "/Applications/Parallels 169 Desktop.app/Contents/Resources/Tools/" 170 171 ## Boot Command 172 173 The `boot_command` specifies the keys to type when the virtual machine is first 174 booted. This command is typed after `boot_wait`. 175 176 As documented above, the `boot_command` is an array of strings. The strings are 177 all typed in sequence. It is an array only to improve readability within the 178 template. 179 180 The boot command is "typed" character for character (using the Parallels 181 Virtualization SDK, see [Parallels Builder](/docs/builders/parallels.html)) 182 simulating a human actually typing the keyboard. There are a set of special keys 183 available. If these are in your boot command, they will be replaced by the 184 proper key: 185 186 - `<bs>` - Backspace 187 188 - `<del>` - Delete 189 190 - `<enter>` and `<return>` - Simulates an actual "enter" or "return" keypress. 191 192 - `<esc>` - Simulates pressing the escape key. 193 194 - `<tab>` - Simulates pressing the tab key. 195 196 - `<f1>` - `<f12>` - Simulates pressing a function key. 197 198 - `<up>` `<down>` `<left>` `<right>` - Simulates pressing an arrow key. 199 200 - `<spacebar>` - Simulates pressing the spacebar. 201 202 - `<insert>` - Simulates pressing the insert key. 203 204 - `<home>` `<end>` - Simulates pressing the home and end keys. 205 206 - `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys. 207 208 - `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key. 209 210 - `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key. 211 212 - `<leftShift>` `<rightShift>` - Simulates pressing the shift key. 213 214 - `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key. 215 216 - `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key. 217 218 - `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key. 219 220 - `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key. 221 222 - `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key. 223 224 - `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key. 225 226 - `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before 227 sending any additional keys. This is useful if you have to generally wait 228 for the UI to update before typing more. 229 230 In addition to the special keys, each command to type is treated as a 231 [template engine](/docs/templates/engine.html). The 232 available variables are: 233 234 ## prlctl Commands 235 236 In order to perform extra customization of the virtual machine, a template can 237 define extra calls to `prlctl` to perform. 238 [prlctl](http://download.parallels.com/desktop/v9/ga/docs/en_US/Parallels%20Command%20Line%20Reference%20Guide.pdf) 239 is the command-line interface to Parallels Desktop. It can be used to configure 240 the virtual machine, such as set RAM, CPUs, etc. 241 242 Extra `prlctl` commands are defined in the template in the `prlctl` section. An 243 example is shown below that sets the memory and number of CPUs within the 244 virtual machine: 245 246 ``` json 247 { 248 "prlctl": [ 249 ["set", "{{.Name}}", "--memsize", "1024"], 250 ["set", "{{.Name}}", "--cpus", "2"] 251 ] 252 } 253 ``` 254 255 The value of `prlctl` is an array of commands to execute. These commands are 256 executed in the order defined. So in the above example, the memory will be set 257 followed by the CPUs. 258 259 Each command itself is an array of strings, where each string is an argument to 260 `prlctl`. Each argument is treated as a [configuration 261 template](/docs/templates/engine.html). The only available 262 variable is `Name` which is replaced with the unique name of the VM, which is 263 required for many `prlctl` calls.