github.com/homburg/packer@v0.6.1-0.20140528012651-1dcaf1716848/website/source/docs/builders/parallels-pvm.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Parallels Builder (from a PVM)" 4 --- 5 6 # Parallels Builder (from a PVM) 7 8 Type: `parallels-pvm` 9 10 This Parallels builder is able to create 11 [Parallels Desktop for Mac](http://www.parallels.com/products/desktop/) 12 virtual machines and export them in the PVM format, starting from an 13 existing PVM (exported virtual machine image). 14 15 The builder builds a virtual machine by importing an existing PVM 16 file. It then boots this image, runs provisioners on this new VM, and 17 exports that VM to create the image. The imported machine is deleted prior 18 to finishing the build. 19 20 ## Basic Example 21 22 Here is a basic example. This example is functional if you have an PVM matching 23 the settings here. 24 25 <pre class="prettyprint"> 26 { 27 "type": "parallels-pvm", 28 "source_path": "source.pvm", 29 "ssh_username": "packer", 30 "ssh_password": "packer", 31 "ssh_wait_timeout": "30s", 32 "shutdown_command": "echo 'packer' | sudo -S shutdown -P now" 33 } 34 </pre> 35 36 It is important to add a `shutdown_command`. By default Packer halts the 37 virtual machine and the file system may not be sync'd. Thus, changes made in a 38 provisioner might not be saved. 39 40 ## Configuration Reference 41 42 There are many configuration options available for the Parallels builder. 43 They are organized below into two categories: required and optional. Within 44 each category, the available options are alphabetized and described. 45 46 ### Required: 47 48 * `source_path` (string) - The path to a PVM directory that acts as 49 the source of this build. 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 * `floppy_files` (array of strings) - A list of files to put onto a floppy 57 disk that is attached when the VM is booted for the first time. This is 58 most useful for unattended Windows installs, which look for an 59 `Autounattend.xml` file on removable media. By default no floppy will 60 be attached. The files listed in this configuration will all be put 61 into the root directory of the floppy disk; sub-directories are not supported. 62 63 * `output_directory` (string) - This is the path to the directory where the 64 resulting virtual machine will be created. This may be relative or absolute. 65 If relative, the path is relative to the working directory when `packer` 66 is executed. This directory must not exist or be empty prior to running the builder. 67 By default this is "output-BUILDNAME" where "BUILDNAME" is the name 68 of the build. 69 70 * `parallels_tools_guest_path` (string) - The path on the guest virtual machine 71 where the Parallels tools ISO will be uploaded. By default this is 72 "prl-tools.iso" which should upload into the login directory of the user. 73 This is a configuration template where the `Version` variable is replaced 74 with the prlctl version. 75 76 * `parallels_tools_host_path` (string) - The path to the Parallels Tools ISO to 77 upload. By default the Parallels builder will use the "other" OS tools ISO from 78 the Parallels installation: 79 "/Applications/Parallels Desktop.app/Contents/Resources/Tools/prl-tools-other.iso" 80 81 * `parallels_tools_mode` (string) - The method by which Parallels tools are 82 made available to the guest for installation. Valid options are "upload", 83 "attach", or "disable". The functions of each of these should be 84 self-explanatory. The default value is "upload". 85 86 * `prlctl` (array of array of strings) - Custom `prlctl` commands to execute in 87 order to further customize the virtual machine being created. The value of 88 this is an array of commands to execute. The commands are executed in the order 89 defined in the template. For each command, the command is defined itself as an 90 array of strings, where each string represents a single argument on the 91 command-line to `prlctl` (but excluding `prlctl` itself). Each arg is treated 92 as a [configuration template](/docs/templates/configuration-templates.html), 93 where the `Name` variable is replaced with the VM name. More details on how 94 to use `prlctl` are below. 95 96 * `prlctl_version_file` (string) - The path within the virtual machine to upload 97 a file that contains the `prlctl` version that was used to create the machine. 98 This information can be useful for provisioning. By default this is 99 ".prlctl_version", which will generally upload it into the home directory. 100 101 * `shutdown_command` (string) - The command to use to gracefully shut down 102 the machine once all the provisioning is done. By default this is an empty 103 string, which tells Packer to just forcefully shut down the machine. 104 105 * `shutdown_timeout` (string) - The amount of time to wait after executing 106 the `shutdown_command` for the virtual machine to actually shut down. 107 If it doesn't shut down in this time, it is an error. By default, the timeout 108 is "5m", or five minutes. 109 110 * `ssh_key_path` (string) - Path to a private key to use for authenticating 111 with SSH. By default this is not set (key-based auth won't be used). 112 The associated public key is expected to already be configured on the 113 VM being prepared by some other process (kickstart, etc.). 114 115 * `ssh_password` (string) - The password for `ssh_username` to use to 116 authenticate with SSH. By default this is the empty string. 117 118 * `ssh_port` (integer) - The port that SSH will be listening on in the guest 119 virtual machine. By default this is 22. 120 121 * `ssh_wait_timeout` (string) - The duration to wait for SSH to become 122 available. By default this is "20m", or 20 minutes. Note that this should 123 be quite long since the timer begins as soon as the virtual machine is booted. 124 125 * `vm_name` (string) - This is the name of the virtual machine when it is 126 imported as well as the name of the PVM directory when the virtual machine is 127 exported. By default this is "packer-BUILDNAME", where "BUILDNAME" is 128 the name of the build. 129 130 ## Parallels Tools 131 After the virtual machine is up and the operating system is installed, Packer 132 uploads the Parallels Tools into the virtual machine. The path where they are 133 uploaded is controllable by `parallels_tools_path`, and defaults to 134 "prl-tools.iso". Without an absolute path, it is uploaded to the home directory 135 of the SSH user. Parallels Tools ISO's can be found in: 136 "/Applications/Parallels Desktop.app/Contents/Resources/Tools/" 137 138 ## prlctl Commands 139 In order to perform extra customization of the virtual machine, a template can 140 define extra calls to `prlctl` to perform. 141 [prlctl](http://download.parallels.com/desktop/v4/wl/docs/en/Parallels_Command_Line_Reference_Guide/) 142 is the command-line interface to Parallels. It can be used to do things such as 143 set RAM, CPUs, etc. 144 145 Extra `prlctl` commands are defined in the template in the `prlctl` section. 146 An example is shown below that sets the memory and number of CPUs within the 147 virtual machine: 148 149 <pre class="prettyprint"> 150 { 151 "prlctl": [ 152 ["set", "{{.Name}}", "--memsize", "1024"], 153 ["set", "{{.Name}}", "--cpus", "2"] 154 ] 155 } 156 </pre> 157 158 The value of `prlctl` is an array of commands to execute. These commands are 159 executed in the order defined. So in the above example, the memory will be set 160 followed by the CPUs. 161 162 Each command itself is an array of strings, where each string is an argument to 163 `prlctl`. Each argument is treated as a 164 [configuration template](/docs/templates/configuration-templates.html). The only 165 available variable is `Name` which is replaced with the unique name of the VM, 166 which is required for many `prlctl` calls.