github.com/kikitux/packer@v0.10.1-0.20160322154024-6237df566f9f/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 put onto a floppy 83 disk that is attached when the VM is booted for the first time. This is most 84 useful for unattended Windows installs, which look for an `Autounattend.xml` 85 file on removable media. By default no floppy will be attached. The files 86 listed in this configuration will all be put into the root directory of the 87 floppy disk; sub-directories are not supported. 88 89 - `output_directory` (string) - This is the path to the directory where the 90 resulting virtual machine will be created. This may be relative or absolute. 91 If relative, the path is relative to the working directory when `packer` 92 is executed. This directory must not exist or be empty prior to running 93 the builder. By default this is "output-BUILDNAME" where "BUILDNAME" is the 94 name of the build. 95 96 - `parallels_tools_guest_path` (string) - The path in the VM to upload 97 Parallels Tools. This only takes effect if `parallels_tools_mode` 98 is "upload". This is a [configuration 99 template](/docs/templates/configuration-templates.html) that has a single 100 valid variable: `Flavor`, which will be the value of 101 `parallels_tools_flavor`. By default this is "prl-tools-{{.Flavor}}.iso" 102 which should upload into the login directory of the user. 103 104 - `parallels_tools_mode` (string) - The method by which Parallels Tools are 105 made available to the guest for installation. Valid options are "upload", 106 "attach", or "disable". If the mode is "attach" the Parallels Tools ISO will 107 be attached as a CD device to the virtual machine. If the mode is "upload" 108 the Parallels Tools ISO will be uploaded to the path specified by 109 `parallels_tools_guest_path`. The default value is "upload". 110 111 - `prlctl` (array of array of strings) - Custom `prlctl` commands to execute 112 in order to further customize the virtual machine being created. The value 113 of this is an array of commands to execute. The commands are executed in the 114 order defined in the template. For each command, the command is defined 115 itself as an array of strings, where each string represents a single 116 argument on the command-line to `prlctl` (but excluding `prlctl` itself). 117 Each arg is treated as a [configuration 118 template](/docs/templates/configuration-templates.html), where the `Name` 119 variable is replaced with the VM name. More details on how to use `prlctl` 120 are below. 121 122 - `prlctl_post` (array of array of strings) - Identical to `prlctl`, except 123 that it is run after the virtual machine is shutdown, and before the virtual 124 machine is exported. 125 126 - `prlctl_version_file` (string) - The path within the virtual machine to 127 upload a file that contains the `prlctl` version that was used to create 128 the machine. This information can be useful for provisioning. By default 129 this is ".prlctl\_version", which will generally upload it into the 130 home directory. 131 132 - `reassign_mac` (boolean) - If this is "false" the MAC address of the first 133 NIC will reused when imported else a new MAC address will be generated 134 by Parallels. Defaults to "false". 135 136 - `shutdown_command` (string) - The command to use to gracefully shut down the 137 machine once all the provisioning is done. By default this is an empty 138 string, which tells Packer to just forcefully shut down the machine. 139 140 - `shutdown_timeout` (string) - The amount of time to wait after executing the 141 `shutdown_command` for the virtual machine to actually shut down. If it 142 doesn't shut down in this time, it is an error. By default, the timeout is 143 "5m", or five minutes. 144 145 - `skip_compaction` (boolean) - Virtual disk image is compacted at the end of 146 the build process using `prl_disk_tool` utility. In certain rare cases, this 147 might corrupt the resulting disk image. If you find this to be the case, 148 you can disable compaction using this configuration value. 149 150 - `vm_name` (string) - This is the name of the virtual machine when it is 151 imported as well as the name of the PVM directory when the virtual machine 152 is exported. By default this is "packer-BUILDNAME", where "BUILDNAME" is the 153 name of the build. 154 155 ## Parallels Tools 156 157 After the virtual machine is up and the operating system is installed, Packer 158 uploads the Parallels Tools into the virtual machine. The path where they are 159 uploaded is controllable by `parallels_tools_path`, and defaults to 160 "prl-tools.iso". Without an absolute path, it is uploaded to the home directory 161 of the SSH user. Parallels Tools ISO's can be found in: "/Applications/Parallels 162 Desktop.app/Contents/Resources/Tools/" 163 164 ## Boot Command 165 166 The `boot_command` specifies the keys to type when the virtual machine is first 167 booted. This command is typed after `boot_wait`. 168 169 As documented above, the `boot_command` is an array of strings. The strings are 170 all typed in sequence. It is an array only to improve readability within the 171 template. 172 173 The boot command is "typed" character for character (using the Parallels 174 Virtualization SDK, see [Parallels Builder](/docs/builders/parallels.html)) 175 simulating a human actually typing the keyboard. There are a set of special keys 176 available. If these are in your boot command, they will be replaced by the 177 proper key: 178 179 - `<bs>` - Backspace 180 181 - `<del>` - Delete 182 183 - `<enter>` and `<return>` - Simulates an actual "enter" or "return" keypress. 184 185 - `<esc>` - Simulates pressing the escape key. 186 187 - `<tab>` - Simulates pressing the tab key. 188 189 - `<f1>` - `<f12>` - Simulates pressing a function key. 190 191 - `<up>` `<down>` `<left>` `<right>` - Simulates pressing an arrow key. 192 193 - `<spacebar>` - Simulates pressing the spacebar. 194 195 - `<insert>` - Simulates pressing the insert key. 196 197 - `<home>` `<end>` - Simulates pressing the home and end keys. 198 199 - `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys. 200 201 - `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before 202 sending any additional keys. This is useful if you have to generally wait 203 for the UI to update before typing more. 204 205 In addition to the special keys, each command to type is treated as a 206 [configuration template](/docs/templates/configuration-templates.html). The 207 available variables are: 208 209 ## prlctl Commands 210 211 In order to perform extra customization of the virtual machine, a template can 212 define extra calls to `prlctl` to perform. 213 [prlctl](http://download.parallels.com/desktop/v9/ga/docs/en_US/Parallels%20Command%20Line%20Reference%20Guide.pdf) 214 is the command-line interface to Parallels Desktop. It can be used to configure 215 the virtual machine, such as set RAM, CPUs, etc. 216 217 Extra `prlctl` commands are defined in the template in the `prlctl` section. An 218 example is shown below that sets the memory and number of CPUs within the 219 virtual machine: 220 221 ``` {.javascript} 222 { 223 "prlctl": [ 224 ["set", "{{.Name}}", "--memsize", "1024"], 225 ["set", "{{.Name}}", "--cpus", "2"] 226 ] 227 } 228 ``` 229 230 The value of `prlctl` is an array of commands to execute. These commands are 231 executed in the order defined. So in the above example, the memory will be set 232 followed by the CPUs. 233 234 Each command itself is an array of strings, where each string is an argument to 235 `prlctl`. Each argument is treated as a [configuration 236 template](/docs/templates/configuration-templates.html). The only available 237 variable is `Name` which is replaced with the unique name of the VM, which is 238 required for many `prlctl` calls.