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