github.com/amanya/packer@v0.12.1-0.20161117214323-902ac5ab2eb6/website/source/docs/builders/parallels-pvm.html.md (about)

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