2013-12-26 19:10:53 -05:00
|
|
|
---
|
2018-04-13 22:48:19 -04:00
|
|
|
modeline: |
|
|
|
|
vim: set ft=pandoc:
|
2017-06-14 21:04:16 -04:00
|
|
|
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.
|
2015-07-22 22:31:00 -04:00
|
|
|
layout: docs
|
2017-06-14 21:04:16 -04:00
|
|
|
page_title: 'VMware VMX - Builders'
|
|
|
|
sidebar_current: 'docs-builders-vmware-vmx'
|
2017-03-25 18:13:52 -04:00
|
|
|
---
|
2013-12-26 19:10:53 -05:00
|
|
|
|
|
|
|
# VMware Builder (from VMX)
|
|
|
|
|
|
|
|
Type: `vmware-vmx`
|
|
|
|
|
2014-10-20 16:47:30 -04:00
|
|
|
This VMware Packer builder is able to create VMware virtual machines from an
|
2015-07-22 22:31:00 -04:00
|
|
|
existing VMware virtual machine (a VMX file). It currently supports building
|
|
|
|
virtual machines on hosts running [VMware Fusion
|
2016-01-14 15:31:19 -05:00
|
|
|
Professional](https://www.vmware.com/products/fusion-professional/) for OS X,
|
|
|
|
[VMware Workstation](https://www.vmware.com/products/workstation/overview.html)
|
2015-07-22 22:31:00 -04:00
|
|
|
for Linux and Windows, and [VMware
|
2016-01-14 15:31:19 -05:00
|
|
|
Player](https://www.vmware.com/products/player/) on Linux.
|
2013-12-26 19:10:53 -05:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
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.
|
2013-12-26 19:10:53 -05:00
|
|
|
|
|
|
|
## Basic Example
|
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
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:
|
2013-12-26 19:10:53 -05:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
``` json
|
2013-12-26 19:10:53 -05:00
|
|
|
{
|
|
|
|
"type": "vmware-vmx",
|
|
|
|
"source_path": "/path/to/a/vm.vmx",
|
|
|
|
"ssh_username": "root",
|
|
|
|
"ssh_password": "root",
|
|
|
|
"shutdown_command": "shutdown -P now"
|
|
|
|
}
|
2014-10-20 13:55:16 -04:00
|
|
|
```
|
2013-12-26 19:10:53 -05:00
|
|
|
|
|
|
|
## Configuration Reference
|
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
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.
|
2013-12-26 19:10:53 -05:00
|
|
|
|
2015-06-23 17:44:57 -04:00
|
|
|
In addition to the options listed here, a
|
2015-07-22 22:31:00 -04:00
|
|
|
[communicator](/docs/templates/communicator.html) can be configured for this
|
|
|
|
builder.
|
2015-06-23 17:44:57 -04:00
|
|
|
|
2019-06-20 08:59:30 -04:00
|
|
|
|
|
|
|
## 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.
|
|
|
|
|
2014-05-04 13:47:40 -04:00
|
|
|
### Required:
|
2013-12-26 19:10:53 -05:00
|
|
|
|
2019-06-20 08:59:30 -04:00
|
|
|
<%= partial "partials/builder/virtualbox/ovf/Config-required" %>
|
|
|
|
|
|
|
|
#### Optional:
|
|
|
|
|
|
|
|
<%= partial "partials/builder/virtualbox/ovf/Config-not-required" %>
|
|
|
|
<%= partial "partials/builder/virtualbox/common/VBoxVersionConfig-not-required" %>
|
|
|
|
<%= partial "partials/builder/virtualbox/common/GuestAdditionsConfig-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/virtualbox/common/ExportConfig-not-required" %>
|
|
|
|
|
|
|
|
### Output configuration
|
|
|
|
|
|
|
|
#### Optional:
|
|
|
|
|
|
|
|
<%= partial "partials/builder/virtualbox/common/OutputConfig-not-required" %>
|
|
|
|
|
|
|
|
### Run configuration
|
|
|
|
|
|
|
|
#### Optional:
|
|
|
|
|
|
|
|
<%= partial "partials/builder/virtualbox/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" %>
|
|
|
|
|
|
|
|
### Shutdown configuration
|
|
|
|
|
|
|
|
#### Optional:
|
|
|
|
|
|
|
|
<%= partial "partials/builder/virtualbox/common/ShutdownConfig-not-required" %>
|
|
|
|
|
|
|
|
### Communicator configuration
|
|
|
|
|
|
|
|
#### Optional common fields:
|
|
|
|
|
|
|
|
<%= partial "partials/helper/communicator/Config-not-required" %>
|
|
|
|
|
|
|
|
#### Optional SSH fields:
|
|
|
|
|
|
|
|
<%= partial "partials/helper/communicator/SSH-not-required" %>
|
|
|
|
<%= partial "partials/builder/virtualbox/common/SSHConfig-not-required" %>
|
|
|
|
|
|
|
|
#### Optional WinRM fields:
|
|
|
|
|
|
|
|
<%= partial "partials/helper/communicator/WinRM-not-required" %>
|
2016-08-02 16:58:04 -04:00
|
|
|
|
|
|
|
## Boot Command
|
|
|
|
|
|
|
|
The `boot_command` configuration is very important: it specifies the keys to
|
|
|
|
type when the virtual machine is first booted in order to start the OS
|
2016-09-20 11:55:56 -04:00
|
|
|
installer. This command is typed after `boot_wait`.
|
2016-08-02 16:58:04 -04:00
|
|
|
|
|
|
|
As documented above, the `boot_command` is an array of strings. The strings are
|
|
|
|
all typed in sequence. It is an array only to improve readability within the
|
|
|
|
template.
|
|
|
|
|
|
|
|
The boot command is "typed" character for character over a VNC connection to the
|
2017-01-14 20:56:04 -05:00
|
|
|
machine, simulating a human actually typing the keyboard.
|
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
-> Keystrokes are typed as separate key up/down events over VNC with a
|
|
|
|
default 100ms delay. The delay alleviates issues with latency and CPU
|
2018-08-22 14:25:43 -04:00
|
|
|
contention. You can tune this delay on a per-builder basis by specifying
|
|
|
|
"boot_key_interval" in your Packer template, for example:
|
|
|
|
|
|
|
|
```
|
|
|
|
{
|
|
|
|
"builders": [
|
|
|
|
{
|
|
|
|
"type": "vmware-vmx",
|
2018-08-23 16:16:01 -04:00
|
|
|
"boot_key_interval": "10ms"
|
2018-08-22 14:25:43 -04:00
|
|
|
...
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2017-02-09 01:01:41 -05:00
|
|
|
- `<f1>` - `<f12>` - Simulates pressing a function key.
|
|
|
|
|
|
|
|
- `<up>` `<down>` `<left>` `<right>` - Simulates pressing an arrow key.
|
|
|
|
|
|
|
|
- `<spacebar>` - Simulates pressing the spacebar.
|
|
|
|
|
|
|
|
- `<insert>` - Simulates pressing the insert key.
|
|
|
|
|
|
|
|
- `<home>` `<end>` - Simulates pressing the home and end keys.
|
|
|
|
|
|
|
|
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
|
|
|
|
|
|
|
- `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key.
|
|
|
|
|
|
|
|
- `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key.
|
|
|
|
|
|
|
|
- `<leftShift>` `<rightShift>` - Simulates pressing the shift key.
|
|
|
|
|
|
|
|
- `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
|
|
|
|
|
|
|
|
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl
|
|
|
|
key.
|
|
|
|
|
|
|
|
- `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the
|
|
|
|
shift key.
|
|
|
|
|
|
|
|
- `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key.
|
|
|
|
|
|
|
|
- `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key.
|
|
|
|
|
|
|
|
- `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key.
|
|
|
|
|
|
|
|
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
|
|
|
sending any additional keys. This is useful if you have to generally wait
|
|
|
|
for the UI to update before typing more.
|
|
|
|
|
|
|
|
In addition to the special keys, each command to type is treated as a
|
|
|
|
[configuration template](/docs/templates/configuration-templates.html). The
|
|
|
|
available variables are:
|
|
|
|
|
2018-04-13 19:48:26 -04:00
|
|
|
<%= partial "partials/builders/boot-command" %>
|
2016-08-02 16:58:04 -04:00
|
|
|
|
|
|
|
Example boot command. This is actually a working boot command used to start an
|
|
|
|
Ubuntu 12.04 installer:
|
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
``` text
|
2016-08-02 16:58:04 -04:00
|
|
|
[
|
|
|
|
"<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>"
|
|
|
|
]
|
2016-11-21 14:50:26 -05:00
|
|
|
```
|
2017-10-12 01:58:03 -04:00
|
|
|
|
|
|
|
For more examples of various boot commands, see the sample projects from our
|
2017-10-13 21:59:58 -04:00
|
|
|
[community templates page](/community-tools.html#templates).
|
2019-04-19 18:57:54 -04:00
|
|
|
|
|
|
|
<%= partial "partials/builders/building_on_remote_vsphere_hypervisor" %>
|