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