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