github.com/askholme/packer@v0.7.2-0.20140924152349-70d9566a6852/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    "parallels_tools_flavor": "lin"
    29    "source_path": "source.pvm",
    30    "ssh_username": "packer",
    31    "ssh_password": "packer",
    32    "ssh_wait_timeout": "30s",
    33    "shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
    34  }
    35  </pre>
    36  
    37  It is important to add a `shutdown_command`. By default Packer halts the
    38  virtual machine and the file system may not be sync'd. Thus, changes made in a
    39  provisioner might not be saved.
    40  
    41  ## Configuration Reference
    42  
    43  There are many configuration options available for the Parallels builder.
    44  They are organized below into two categories: required and optional. Within
    45  each category, the available options are alphabetized and described.
    46  
    47  ### Required:
    48  
    49  * `source_path` (string) - The path to a PVM directory that acts as
    50    the source of this build.
    51  
    52  * `ssh_username` (string) - The username to use to SSH into the machine
    53    once the OS is installed.
    54  
    55  * `parallels_tools_flavor` (string) - The flavor of the Parallels Tools ISO to
    56    install into the VM. Valid values are "win", "lin", "mac", "os2" and "other".
    57    This can be ommited only if `parallels_tools_mode` is "disable".
    58  
    59  ### Optional:
    60  
    61  * `boot_command` (array of strings) - This is an array of commands to type
    62    when the virtual machine is first booted. The goal of these commands should
    63    be to type just enough to initialize the operating system installer. Special
    64    keys can be typed as well, and are covered in the section below on the boot
    65    command. If this is not specified, it is assumed the installer will start
    66    itself.
    67  
    68  * `boot_wait` (string) - The time to wait after booting the initial virtual
    69    machine before typing the `boot_command`. The value of this should be
    70    a duration. Examples are "5s" and "1m30s" which will cause Packer to wait
    71    five seconds and one minute 30 seconds, respectively. If this isn't specified,
    72    the default is 10 seconds.
    73  
    74  * `floppy_files` (array of strings) - A list of files to put onto a floppy
    75    disk that is attached when the VM is booted for the first time. This is
    76    most useful for unattended Windows installs, which look for an
    77    `Autounattend.xml` file on removable media. By default no floppy will
    78    be attached. The files listed in this configuration will all be put
    79    into the root directory of the floppy disk; sub-directories are not supported.
    80  
    81  * `reassign_mac` (boolean) - If this is "false" the MAC address of the first
    82    NIC will reused when imported else a new MAC address will be generated by
    83    Parallels. Defaults to "false".
    84  
    85  * `output_directory` (string) - This is the path to the directory where the
    86    resulting virtual machine will be created. This may be relative or absolute.
    87    If relative, the path is relative to the working directory when `packer`
    88    is executed. This directory must not exist or be empty prior to running the builder.
    89    By default this is "output-BUILDNAME" where "BUILDNAME" is the name
    90    of the build.
    91  
    92  * `parallels_tools_guest_path` (string) - The path in the VM to upload Parallels
    93    Tools. This only takes effect if `parallels_tools_mode` is not "disable".
    94    This is a [configuration template](/docs/templates/configuration-templates.html)
    95    that has a single valid variable: `Flavor`, which will be the value of
    96    `parallels_tools_flavor`. By default the upload path is set to
    97    `prl-tools-{{.Flavor}}.iso`.
    98  
    99  * `parallels_tools_mode` (string) - The method by which Parallels Tools are
   100    made available to the guest for installation. Valid options are "upload",
   101    "attach", or "disable". The functions of each of these should be
   102    self-explanatory. The default value is "upload".
   103  
   104  * `prlctl` (array of array of strings) - Custom `prlctl` commands to execute in
   105    order to further customize the virtual machine being created. The value of
   106    this is an array of commands to execute. The commands are executed in the order
   107    defined in the template. For each command, the command is defined itself as an
   108    array of strings, where each string represents a single argument on the
   109    command-line to `prlctl` (but excluding `prlctl` itself). Each arg is treated
   110    as a [configuration template](/docs/templates/configuration-templates.html),
   111    where the `Name` variable is replaced with the VM name. More details on how
   112    to use `prlctl` are below.
   113  
   114  * `prlctl_version_file` (string) - The path within the virtual machine to upload
   115    a file that contains the `prlctl` version that was used to create the machine.
   116    This information can be useful for provisioning. By default this is
   117    ".prlctl_version", which will generally upload it into the home directory.
   118  
   119  * `shutdown_command` (string) - The command to use to gracefully shut down
   120    the machine once all the provisioning is done. By default this is an empty
   121    string, which tells Packer to just forcefully shut down the machine.
   122  
   123  * `shutdown_timeout` (string) - The amount of time to wait after executing
   124    the `shutdown_command` for the virtual machine to actually shut down.
   125    If it doesn't shut down in this time, it is an error. By default, the timeout
   126    is "5m", or five minutes.
   127  
   128  * `ssh_key_path` (string) - Path to a private key to use for authenticating
   129    with SSH. By default this is not set (key-based auth won't be used).
   130    The associated public key is expected to already be configured on the
   131    VM being prepared by some other process (kickstart, etc.).
   132  
   133  * `ssh_password` (string) - The password for `ssh_username` to use to
   134    authenticate with SSH. By default this is the empty string.
   135  
   136  * `ssh_port` (integer) - The port that SSH will be listening on in the guest
   137    virtual machine. By default this is 22.
   138  
   139  * `ssh_wait_timeout` (string) - The duration to wait for SSH to become
   140    available. By default this is "20m", or 20 minutes. Note that this should
   141    be quite long since the timer begins as soon as the virtual machine is booted.
   142  
   143  * `vm_name` (string) - This is the name of the virtual machine when it is
   144    imported as well as the name of the PVM directory when the virtual machine is
   145    exported. By default this is "packer-BUILDNAME", where "BUILDNAME" is
   146    the name of the build.
   147  
   148  ## Parallels Tools
   149  After the virtual machine is up and the operating system is installed, Packer
   150  uploads the Parallels Tools into the virtual machine. The path where they are
   151  uploaded is controllable by `parallels_tools_path`, and defaults to
   152  "prl-tools.iso". Without an absolute path, it is uploaded to the home directory
   153  of the SSH user. Parallels Tools ISO's can be found in:
   154  "/Applications/Parallels Desktop.app/Contents/Resources/Tools/"
   155  
   156  ## Boot Command
   157  
   158  The `boot_command` specifies the keys to type when the virtual machine is first booted. This command is typed after `boot_wait`.
   159  
   160  As documented above, the `boot_command` is an array of strings. The
   161  strings are all typed in sequence. It is an array only to improve readability
   162  within the template.
   163  
   164  The boot command is "typed" character for character using the `prltype` (part
   165  of prl-utils, see [Parallels Builder](/docs/builders/parallels.html))
   166  command connected to the machine, simulating a human actually typing the
   167  keyboard. There are a set of special keys available. If these are in your
   168  boot command, they will be replaced by the proper key:
   169  
   170  * `<enter>` and `<return>` - Simulates an actual "enter" or "return" keypress.
   171  
   172  * `<esc>` - Simulates pressing the escape key.
   173  
   174  * `<tab>` - Simulates pressing the tab key.
   175  
   176  * `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before sending
   177    any additional keys. This is useful if you have to generally wait for the UI
   178    to update before typing more.
   179  
   180  In addition to the special keys, each command to type is treated as a
   181  [configuration template](/docs/templates/configuration-templates.html).
   182  The available variables are:
   183  
   184  ## prlctl Commands
   185  In order to perform extra customization of the virtual machine, a template can
   186  define extra calls to `prlctl` to perform.
   187  [prlctl](http://download.parallels.com/desktop/v9/ga/docs/en_US/Parallels%20Command%20Line%20Reference%20Guide.pdf)
   188  is the command-line interface to Parallels Desktop. It can be used to configure
   189  the virtual machine, such as set RAM, CPUs, etc.
   190  
   191  Extra `prlctl` commands are defined in the template in the `prlctl` section.
   192  An example is shown below that sets the memory and number of CPUs within the
   193  virtual machine:
   194  
   195  <pre class="prettyprint">
   196  {
   197    "prlctl": [
   198      ["set", "{{.Name}}", "--memsize", "1024"],
   199      ["set", "{{.Name}}", "--cpus", "2"]
   200    ]
   201  }
   202  </pre>
   203  
   204  The value of `prlctl` is an array of commands to execute. These commands are
   205  executed in the order defined. So in the above example, the memory will be set
   206  followed by the CPUs.
   207  
   208  Each command itself is an array of strings, where each string is an argument to
   209  `prlctl`. Each argument is treated as a
   210  [configuration template](/docs/templates/configuration-templates.html). The only
   211  available variable is `Name` which is replaced with the unique name of the VM,
   212  which is required for many `prlctl` calls.