github.com/askholme/packer@v0.7.2-0.20140924152349-70d9566a6852/website/source/docs/builders/vmware-vmx.html.markdown (about)

     1  ---
     2  layout: "docs"
     3  page_title: "VMware Builder from VMX"
     4  ---
     5  
     6  # VMware Builder (from VMX)
     7  
     8  Type: `vmware-vmx`
     9  
    10  This VMware builder is able to create VMware virtual machines from an
    11  existing VMware virtual machine (a VMX file). It currently
    12  supports building virtual machines on hosts running
    13  [VMware Fusion Professional](http://www.vmware.com/products/fusion-professional/) for OS X,
    14  [VMware Workstation](http://www.vmware.com/products/workstation/overview.html)
    15  for Linux and Windows, and
    16  [VMware Player](http://www.vmware.com/products/player/) on Linux.
    17  
    18  The builder builds a virtual machine by cloning the VMX file using
    19  the clone capabilities introduced in VMware Fusion Professional 6, Workstation 10,
    20  and Player 6. After cloning the VM, it provisions software within the
    21  new machine, shuts it down, and compacts the disks. The resulting folder
    22  contains a new VMware virtual machine.
    23  
    24  ## Basic Example
    25  
    26  Here is an example. This example is fully functional as long as the source
    27  path points to a real VMX file with the proper settings:
    28  
    29  <pre class="prettyprint">
    30  {
    31    "type": "vmware-vmx",
    32    "source_path": "/path/to/a/vm.vmx",
    33    "ssh_username": "root",
    34    "ssh_password": "root",
    35    "shutdown_command": "shutdown -P now"
    36  }
    37  </pre>
    38  
    39  ## Configuration Reference
    40  
    41  There are many configuration options available for the VMware builder.
    42  They are organized below into two categories: required and optional. Within
    43  each category, the available options are alphabetized and described.
    44  
    45  ### Required:
    46  
    47  * `source_path` (string) - Path to the source VMX file to clone.
    48  
    49  * `ssh_username` (string) - The username to use to SSH into the machine
    50    once the OS is installed.
    51  
    52  ### Optional:
    53  
    54  * `boot_command` (array of strings) - This is an array of commands to type
    55    when the virtual machine is firsted booted. The goal of these commands should
    56    be to type just enough to initialize the operating system installer. Special
    57    keys can be typed as well, and are covered in the section below on the boot
    58    command. If this is not specified, it is assumed the installer will start
    59    itself.
    60  
    61  * `boot_wait` (string) - The time to wait after booting the initial virtual
    62    machine before typing the `boot_command`. The value of this should be
    63    a duration. Examples are "5s" and "1m30s" which will cause Packer to wait
    64    five seconds and one minute 30 seconds, respectively. If this isn't specified,
    65    the default is 10 seconds.
    66  
    67  * `floppy_files` (array of strings) - A list of files to place onto a floppy
    68    disk that is attached when the VM is booted. This is most useful
    69    for unattended Windows installs, which look for an `Autounattend.xml` file
    70    on removable media. By default, no floppy will be attached. All files
    71    listed in this setting get placed into the root directory of the floppy
    72    and the floppy is attached as the first floppy device. Currently, no
    73    support exists for creating sub-directories on the floppy. Wildcard
    74    characters (*, ?, and []) are allowed. Directory names are also allowed,
    75    which will add all the files found in the directory to the floppy.
    76  
    77  * `fusion_app_path` (string) - Path to "VMware Fusion.app". By default this
    78    is "/Applications/VMware Fusion.app" but this setting allows you to
    79    customize this.
    80  
    81  * `headless` (boolean) - Packer defaults to building VMware
    82    virtual machines by launching a GUI that shows the console of the
    83    machine being built. When this value is set to true, the machine will
    84    start without a console. For VMware machines, Packer will output VNC
    85    connection information in case you need to connect to the console to
    86    debug the build process.
    87  
    88  * `http_directory` (string) - Path to a directory to serve using an HTTP
    89    server. The files in this directory will be available over HTTP that will
    90    be requestable from the virtual machine. This is useful for hosting
    91    kickstart files and so on. By default this is "", which means no HTTP
    92    server will be started. The address and port of the HTTP server will be
    93    available as variables in `boot_command`. This is covered in more detail
    94    below.
    95  
    96  * `http_port_min` and `http_port_max` (integer) - These are the minimum and
    97    maximum port to use for the HTTP server started to serve the `http_directory`.
    98    Because Packer often runs in parallel, Packer will choose a randomly available
    99    port in this range to run the HTTP server. If you want to force the HTTP
   100    server to be on one port, make this minimum and maximum port the same.
   101    By default the values are 8000 and 9000, respectively.
   102  
   103  * `output_directory` (string) - This is the path to the directory where the
   104    resulting virtual machine will be created. This may be relative or absolute.
   105    If relative, the path is relative to the working directory when `packer`
   106    is executed. This directory must not exist or be empty prior to running the builder.
   107    By default this is "output-BUILDNAME" where "BUILDNAME" is the name
   108    of the build.
   109  
   110  * `shutdown_command` (string) - The command to use to gracefully shut down
   111    the machine once all the provisioning is done. By default this is an empty
   112    string, which tells Packer to just forcefully shut down the machine.
   113  
   114  * `shutdown_timeout` (string) - The amount of time to wait after executing
   115    the `shutdown_command` for the virtual machine to actually shut down.
   116    If it doesn't shut down in this time, it is an error. By default, the timeout
   117    is "5m", or five minutes.
   118  
   119  * `skip_compaction` (boolean) -  VMware-created disks are defragmented
   120    and compacted at the end of the build process using `vmware-vdiskmanager`.
   121    In certain rare cases, this might actually end up making the resulting disks
   122    slightly larger. If you find this to be the case, you can disable compaction
   123    using this configuration value.
   124  
   125  * `ssh_key_path` (string) - Path to a private key to use for authenticating
   126    with SSH. By default this is not set (key-based auth won't be used).
   127    The associated public key is expected to already be configured on the
   128    VM being prepared by some other process (kickstart, etc.).
   129  
   130  * `ssh_password` (string) - The password for `ssh_username` to use to
   131    authenticate with SSH. By default this is the empty string.
   132  
   133  * `ssh_port` (integer) - The port that SSH will listen on within the virtual
   134    machine. By default this is 22.
   135  
   136  * `ssh_skip_request_pty` (boolean) - If true, a pty will not be requested as
   137    part of the SSH connection. By default, this is "false", so a pty
   138    _will_ be requested.
   139  
   140  * `ssh_wait_timeout` (string) - The duration to wait for SSH to become
   141    available. By default this is "20m", or 20 minutes. Note that this should
   142    be quite long since the timer begins as soon as the virtual machine is booted.
   143  
   144  * `vm_name` (string) - This is the name of the VMX file for the new virtual
   145    machine, without the file extension. By default this is "packer-BUILDNAME",
   146    where "BUILDNAME" is the name of the build.
   147  
   148  * `vmx_data` (object of key/value strings) - Arbitrary key/values
   149    to enter into the virtual machine VMX file. This is for advanced users
   150    who want to set properties such as memory, CPU, etc.
   151  
   152  * `vmx_data_post` (object of key/value strings) - Identical to `vmx_data`,
   153    except that it is run after the virtual machine is shutdown, and before the
   154    virtual machine is exported.
   155  
   156  * `vnc_port_min` and `vnc_port_max` (integer) - The minimum and maximum port to
   157    use for VNC access to the virtual machine. The builder uses VNC to type
   158    the initial `boot_command`. Because Packer generally runs in parallel, Packer
   159    uses a randomly chosen port in this range that appears available. By default
   160    this is 5900 to 6000. The minimum and maximum ports are inclusive.