github.com/ratanraj/packer@v1.3.2/website/source/docs/builders/parallels-pvm.html.md.erb (about)

     1  ---
     2  modeline: |
     3    vim: set ft=pandoc:
     4  description: |
     5      This Parallels builder is able to create Parallels Desktop for Mac virtual
     6      machines and export them in the PVM format, starting from an existing PVM
     7      (exported virtual machine image).
     8  layout: docs
     9  page_title: 'Parallels PVM - Builders'
    10  sidebar_current: 'docs-builders-parallels-pvm'
    11  ---
    12  
    13  # Parallels Builder (from a PVM)
    14  
    15  Type: `parallels-pvm`
    16  
    17  This Parallels builder is able to create [Parallels Desktop for
    18  Mac](https://www.parallels.com/products/desktop/) virtual machines and export
    19  them in the PVM format, starting from an existing PVM (exported virtual machine
    20  image).
    21  
    22  The builder builds a virtual machine by importing an existing PVM file. It then
    23  boots this image, runs provisioners on this new VM, and exports that VM to
    24  create the image. The imported machine is deleted prior to finishing the build.
    25  
    26  ## Basic Example
    27  
    28  Here is a basic example. This example is functional if you have an PVM matching
    29  the settings here.
    30  
    31  ``` json
    32  {
    33    "type": "parallels-pvm",
    34    "parallels_tools_flavor": "lin",
    35    "source_path": "source.pvm",
    36    "ssh_username": "packer",
    37    "ssh_password": "packer",
    38    "ssh_timeout": "30s",
    39    "shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
    40  }
    41  ```
    42  
    43  It is important to add a `shutdown_command`. By default Packer halts the virtual
    44  machine and the file system may not be sync'd. Thus, changes made in a
    45  provisioner might not be saved.
    46  
    47  ## Configuration Reference
    48  
    49  There are many configuration options available for the Parallels builder. They
    50  are organized below into two categories: required and optional. Within each
    51  category, the available options are alphabetized and described.
    52  
    53  In addition to the options listed here, a
    54  [communicator](/docs/templates/communicator.html) can be configured for this
    55  builder.
    56  
    57  ### Required:
    58  
    59  -   `parallels_tools_flavor` (string) - The flavor of the Parallels Tools ISO to
    60      install into the VM. Valid values are "win", "lin", "mac", "os2"
    61      and "other". This can be omitted only if `parallels_tools_mode`
    62      is "disable".
    63  
    64  -   `source_path` (string) - The path to a PVM directory that acts as the source
    65      of this build.
    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 place onto a floppy
    83      disk that is attached when the VM is booted. This is most useful for
    84      unattended Windows installs, which look for an `Autounattend.xml` file on
    85      removable media. By default, no floppy will be attached. All files listed in
    86      this setting get placed into the root directory of the floppy and the floppy
    87      is attached as the first floppy device. Currently, no support exists for
    88      creating sub-directories on the floppy. Wildcard characters (\*, ?,
    89      and \[\]) are allowed. Directory names are also allowed, which will add all
    90      the files found in the directory to the floppy.
    91  
    92  -   `floppy_dirs` (array of strings) - A list of directories to place onto
    93      the floppy disk recursively. This is similar to the `floppy_files` option
    94      except that the directory structure is preserved. This is useful for when
    95      your floppy disk includes drivers or if you just want to organize it's
    96      contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed.
    97  
    98  -   `output_directory` (string) - This is the path to the directory where the
    99      resulting virtual machine will be created. This may be relative or absolute.
   100      If relative, the path is relative to the working directory when `packer`
   101      is executed. This directory must not exist or be empty prior to running
   102      the builder. By default this is "output-BUILDNAME" where "BUILDNAME" is the
   103      name of the build.
   104  
   105  -   `parallels_tools_guest_path` (string) - The path in the VM to upload
   106      Parallels Tools. This only takes effect if `parallels_tools_mode`
   107      is "upload". This is a [configuration
   108      template](/docs/templates/engine.html) that has a single
   109      valid variable: `Flavor`, which will be the value of
   110      `parallels_tools_flavor`. By default this is "prl-tools-{{.Flavor}}.iso"
   111      which should upload into the login directory of the user.
   112  
   113  -   `parallels_tools_mode` (string) - The method by which Parallels Tools are
   114      made available to the guest for installation. Valid options are "upload",
   115      "attach", or "disable". If the mode is "attach" the Parallels Tools ISO will
   116      be attached as a CD device to the virtual machine. If the mode is "upload"
   117      the Parallels Tools ISO will be uploaded to the path specified by
   118      `parallels_tools_guest_path`. The default value is "upload".
   119  
   120  -   `prlctl` (array of array of strings) - Custom `prlctl` commands to execute
   121      in order to further customize the virtual machine being created. The value
   122      of this is an array of commands to execute. The commands are executed in the
   123      order defined in the template. For each command, the command is defined
   124      itself as an array of strings, where each string represents a single
   125      argument on the command-line to `prlctl` (but excluding `prlctl` itself).
   126      Each arg is treated as a [configuration
   127      template](/docs/templates/engine.html), where the `Name`
   128      variable is replaced with the VM name. More details on how to use `prlctl`
   129      are below.
   130  
   131  -   `prlctl_post` (array of array of strings) - Identical to `prlctl`, except
   132      that it is run after the virtual machine is shutdown, and before the virtual
   133      machine is exported.
   134  
   135  -   `prlctl_version_file` (string) - The path within the virtual machine to
   136      upload a file that contains the `prlctl` version that was used to create
   137      the machine. This information can be useful for provisioning. By default
   138      this is ".prlctl\_version", which will generally upload it into the
   139      home directory.
   140  
   141  -   `reassign_mac` (boolean) - If this is "false" the MAC address of the first
   142      NIC will reused when imported else a new MAC address will be generated
   143      by Parallels. Defaults to "false".
   144  
   145  -   `shutdown_command` (string) - The command to use to gracefully shut down the
   146      machine once all the provisioning is done. By default this is an empty
   147      string, which tells Packer to just forcefully shut down the machine.
   148  
   149  -   `shutdown_timeout` (string) - The amount of time to wait after executing the
   150      `shutdown_command` for the virtual machine to actually shut down. If it
   151      doesn't shut down in this time, it is an error. By default, the timeout is
   152      "5m", or five minutes.
   153  
   154  -   `skip_compaction` (boolean) - Virtual disk image is compacted at the end of
   155      the build process using `prl_disk_tool` utility. In certain rare cases, this
   156      might corrupt the resulting disk image. If you find this to be the case,
   157      you can disable compaction using this configuration value.
   158  
   159  -   `vm_name` (string) - This is the name of the virtual machine when it is
   160      imported as well as the name of the PVM directory when the virtual machine
   161      is exported. By default this is "packer-BUILDNAME", where "BUILDNAME" is the
   162      name of the build.
   163  
   164  ## Parallels Tools
   165  
   166  After the virtual machine is up and the operating system is installed, Packer
   167  uploads the Parallels Tools into the virtual machine. The path where they are
   168  uploaded is controllable by `parallels_tools_path`, and defaults to
   169  "prl-tools.iso". Without an absolute path, it is uploaded to the home directory
   170  of the SSH user. Parallels Tools ISO's can be found in: "/Applications/Parallels
   171  Desktop.app/Contents/Resources/Tools/"
   172  
   173  ## Boot Command
   174  
   175  The `boot_command` specifies the keys to type when the virtual machine is first
   176  booted. This command is typed after `boot_wait`.
   177  
   178  As documented above, the `boot_command` is an array of strings. The strings are
   179  all typed in sequence. It is an array only to improve readability within the
   180  template.
   181  
   182  The boot command is "typed" character for character (using the Parallels
   183  Virtualization SDK, see [Parallels Builder](/docs/builders/parallels.html))
   184  simulating a human actually typing the keyboard.
   185  
   186  <%= partial "partials/builders/boot-command" %>
   187  
   188  ## prlctl Commands
   189  
   190  In order to perform extra customization of the virtual machine, a template can
   191  define extra calls to `prlctl` to perform.
   192  [prlctl](http://download.parallels.com/desktop/v9/ga/docs/en_US/Parallels%20Command%20Line%20Reference%20Guide.pdf)
   193  is the command-line interface to Parallels Desktop. It can be used to configure
   194  the virtual machine, such as set RAM, CPUs, etc.
   195  
   196  Extra `prlctl` commands are defined in the template in the `prlctl` section. An
   197  example is shown below that sets the memory and number of CPUs within the
   198  virtual machine:
   199  
   200  ``` json
   201  {
   202    "prlctl": [
   203      ["set", "{{.Name}}", "--memsize", "1024"],
   204      ["set", "{{.Name}}", "--cpus", "2"]
   205    ]
   206  }
   207  ```
   208  
   209  The value of `prlctl` is an array of commands to execute. These commands are
   210  executed in the order defined. So in the above example, the memory will be set
   211  followed by the CPUs.
   212  
   213  Each command itself is an array of strings, where each string is an argument to
   214  `prlctl`. Each argument is treated as a [configuration
   215  template](/docs/templates/engine.html). The only available
   216  variable is `Name` which is replaced with the unique name of the VM, which is
   217  required for many `prlctl` calls.