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