206 lines
5.8 KiB
Plaintext
206 lines
5.8 KiB
Plaintext
---
|
|
modeline: |
|
|
vim: set ft=pandoc:
|
|
description: |
|
|
This VMware Packer builder is able to create VMware virtual machines from an
|
|
existing VMware virtual machine (a VMX file). It currently supports building
|
|
virtual machines on hosts running VMware Fusion Professional for OS X, VMware
|
|
Workstation for Linux and Windows, and VMware Player on Linux.
|
|
layout: docs
|
|
page_title: 'VMware VMX - Builders'
|
|
sidebar_current: 'docs-builders-vmware-vmx'
|
|
---
|
|
|
|
# VMware Builder (from VMX)
|
|
|
|
Type: `vmware-vmx`
|
|
|
|
This VMware Packer builder is able to create VMware virtual machines from an
|
|
existing VMware virtual machine (a VMX file). It currently supports building
|
|
virtual machines on hosts running [VMware Fusion
|
|
Professional](https://www.vmware.com/products/fusion-professional/) for OS X,
|
|
[VMware Workstation](https://www.vmware.com/products/workstation/overview.html)
|
|
for Linux and Windows, and [VMware
|
|
Player](https://www.vmware.com/products/player/) on Linux.
|
|
|
|
The builder builds a virtual machine by cloning the VMX file using the clone
|
|
capabilities introduced in VMware Fusion Professional 6, Workstation 10, and
|
|
Player 6. After cloning the VM, it provisions software within the new machine,
|
|
shuts it down, and compacts the disks. The resulting folder contains a new
|
|
VMware virtual machine.
|
|
|
|
## Basic Example
|
|
|
|
Here is an example. This example is fully functional as long as the source path
|
|
points to a real VMX file with the proper settings:
|
|
|
|
``` json
|
|
{
|
|
"type": "vmware-vmx",
|
|
"source_path": "/path/to/a/vm.vmx",
|
|
"ssh_username": "root",
|
|
"ssh_password": "root",
|
|
"shutdown_command": "shutdown -P now"
|
|
}
|
|
```
|
|
|
|
## Configuration Reference
|
|
|
|
There are many configuration options available for the VMware builder. They are
|
|
organized below into two categories: required and optional. Within each
|
|
category, the available options are alphabetized and described.
|
|
|
|
In addition to the options listed here, a
|
|
[communicator](/docs/templates/communicator.html) can be configured for this
|
|
builder.
|
|
|
|
|
|
## Configuration Reference
|
|
|
|
There are many configuration options available for the builder. In addition to
|
|
the items listed here, you will want to look at the general configuration
|
|
references for
|
|
[HTTP](#http-directory-configuration),
|
|
[Floppy](#floppy-configuration),
|
|
[Boot](#boot-configuration),
|
|
[Driver](#driver-configuration),
|
|
[Output](#output-configuration),
|
|
[Run](#run-configuration),
|
|
[Shutdown](#shutdown-configuration),
|
|
[Communicator](#communicator-configuration),
|
|
[Tools](#tools-configuration),
|
|
[vmx](#vmx-configuration),
|
|
[Export](#export-configuration),
|
|
configuration references, which are
|
|
necessary for this build to succeed and can be found further down the page.
|
|
|
|
### Required:
|
|
|
|
<%= partial "partials/builder/vmware/vmx/Config-required" %>
|
|
|
|
#### Optional:
|
|
|
|
<%= partial "partials/builder/vmware/vmx/Config-not-required" %>
|
|
|
|
### Http directory configuration
|
|
|
|
<%= partial "partials/common/HTTPConfig" %>
|
|
#### Optional:
|
|
|
|
<%= partial "partials/common/HTTPConfig-not-required" %>
|
|
|
|
### Floppy configuration
|
|
|
|
<%= partial "partials/common/FloppyConfig" %>
|
|
|
|
#### Optional:
|
|
|
|
<%= partial "partials/common/FloppyConfig-not-required" %>
|
|
|
|
### Export configuration
|
|
|
|
#### Optional:
|
|
|
|
<%= partial "partials/builder/vmware/common/ExportConfig-not-required" %>
|
|
|
|
### Output configuration
|
|
|
|
#### Optional:
|
|
|
|
<%= partial "partials/builder/vmware/common/OutputConfig-not-required" %>
|
|
|
|
### Run configuration
|
|
|
|
#### Optional:
|
|
|
|
<%= partial "partials/builder/vmware/common/RunConfig-not-required" %>
|
|
|
|
### Driver configuration
|
|
|
|
#### Optional:
|
|
|
|
<%= partial "partials/builder/vmware/common/DriverConfig-not-required" %>
|
|
|
|
### Tools configuration
|
|
|
|
#### Optional:
|
|
|
|
<%= partial "partials/builder/vmware/common/ToolsConfig-not-required" %>
|
|
|
|
### VMX configuration
|
|
|
|
#### Optional:
|
|
|
|
<%= partial "partials/builder/vmware/common/VMXConfig-not-required" %>
|
|
|
|
### Communicator configuration
|
|
|
|
#### Optional common fields:
|
|
|
|
<%= partial "partials/helper/communicator/Config-not-required" %>
|
|
|
|
#### Optional SSH fields:
|
|
|
|
<%= partial "partials/helper/communicator/SSH-not-required" %>
|
|
|
|
#### Optional WinRM fields:
|
|
|
|
<%= partial "partials/helper/communicator/WinRM-not-required" %>
|
|
|
|
## Shutdown Configuration
|
|
|
|
<%= partial "partials/common/shutdowncommand/ShutdownConfig-not-required" %>
|
|
|
|
## Boot Configuration
|
|
|
|
<%= partial "partials/common/bootcommand/BootConfig" %>
|
|
<%= partial "partials/common/bootcommand/VNCConfig" %>
|
|
|
|
-> **Note**: for the `HTTPIP` to be resolved correctly, your VM's network
|
|
configuration has to include a `hostonly` or `nat` type network interface.
|
|
If you are using this feature, it is recommended to leave the default network
|
|
configuration while you are building the VM, and use the `vmx_data_post` hook
|
|
to modify the network configuration after the VM is done building.
|
|
|
|
#### Optional:
|
|
|
|
<%= partial "partials/common/bootcommand/VNCConfig-not-required" %>
|
|
<%= partial "partials/common/bootcommand/BootConfig-not-required" %>
|
|
|
|
For more examples of various boot commands, see the sample projects from our
|
|
[community templates page](/community-tools.html#templates).
|
|
|
|
```
|
|
{
|
|
"builders": [
|
|
{
|
|
"type": "vmware-vmx",
|
|
"boot_key_interval": "10ms"
|
|
...
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
Example boot command. This is actually a working boot command used to start an
|
|
Ubuntu 12.04 installer:
|
|
|
|
``` text
|
|
[
|
|
"<esc><esc><enter><wait>",
|
|
"/install/vmlinuz noapic ",
|
|
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
|
|
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
|
|
"hostname={{ .Name }} ",
|
|
"fb=false debconf/frontend=noninteractive ",
|
|
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
|
|
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
|
|
"initrd=/install/initrd.gz -- <enter>"
|
|
]
|
|
```
|
|
|
|
For more examples of various boot commands, see the sample projects from our
|
|
[community templates page](/community-tools.html#templates).
|
|
|
|
<%= partial "partials/builders/building_on_remote_vsphere_hypervisor" %>
|