packer-cn/website/pages/docs/builders/vmware/vsphere-clone.mdx

190 lines
4.4 KiB
Plaintext
Raw Normal View History

2020-03-18 18:46:47 -04:00
---
modeline: |
vim: set ft=pandoc:
description: >
This VMware Packer builder uses the vSphere API to clone an existing vSphere
template and create a new virtual machine remotely.
2020-03-18 18:46:47 -04:00
layout: docs
2020-03-24 19:48:37 -04:00
page_title: VSphere Clone - Builders
sidebar_title: VSphere Clone
2020-03-18 18:46:47 -04:00
---
# VMWare Vsphere Clone Builder
Type: `vsphere-clone`
This builder clones VMs from existing templates.
- VMware Player is not required.
2020-04-02 14:15:08 -04:00
- It uses the official vCenter API, and does not require ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor)
2020-03-18 18:46:47 -04:00
## Examples
See complete Ubuntu, Windows, and macOS templates in the [examples folder](https://github.com/hashicorp/packer/tree/master/builder/vsphere/examples/).
## VSphere-Clone Configuration Reference
There are many configuration options available for this builder. In addition to
the items listed here, you will want to look at the general configuration
references for [Hardware](#hardware-configuration),
2020-03-18 18:46:47 -04:00
[Output](#output-configuration),
[Boot](#boot-configuration),
2020-03-18 18:46:47 -04:00
[Run](#run-configuration),
[Shutdown](#shutdown-configuration),
[Communicator](#communicator-configuration),
[Export](#export-configuration),
configuration references, which are
necessary for this build to succeed and can be found further down the page.
2020-03-23 20:02:12 -04:00
@include 'builder/vsphere/clone/Config-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Clone Configuration
2020-03-23 20:02:12 -04:00
@include 'builder/vsphere/clone/CloneConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Extra Configuration Parameters
2020-03-23 20:02:12 -04:00
@include 'builder/vsphere/common/ConfigParamsConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Boot configuration
@include 'common/bootcommand/BootConfig.mdx'
#### Optional:
@include 'common/bootcommand/BootConfig-not-required.mdx'
@include 'builder/vsphere/common/BootConfig-not-required.mdx'
### Http directory configuration
@include 'common/HTTPConfig.mdx'
#### Optional:
@include 'common/HTTPConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Connection Configuration
2020-03-23 20:02:12 -04:00
@include 'builder/vsphere/common/ConnectConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Hardware Configuration
2020-03-23 20:02:12 -04:00
@include 'builder/vsphere/common/HardwareConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Location Configuration
2020-03-23 20:02:12 -04:00
@include 'builder/vsphere/common/LocationConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Run Configuration
2020-03-23 20:02:12 -04:00
@include 'builder/vsphere/common/RunConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Shutdown Configuration
2020-03-23 20:02:12 -04:00
@include 'builder/vsphere/common/ShutdownConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Wait Configuration
2020-03-23 20:02:12 -04:00
@include 'builder/vsphere/common/WaitIpConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Communicator configuration
#### Optional common fields:
2020-03-23 20:02:12 -04:00
@include 'helper/communicator/Config-not-required.mdx'
2020-03-18 18:46:47 -04:00
#### Optional SSH fields:
2020-03-23 20:02:12 -04:00
@include 'helper/communicator/SSH-not-required.mdx'
2020-03-18 18:46:47 -04:00
#### Optional WinRM fields:
2020-03-23 20:02:12 -04:00
@include 'helper/communicator/WinRM-not-required.mdx'
2020-03-18 18:46:47 -04:00
### Export Configuration
2020-04-02 14:15:08 -04:00
@include 'builder/vsphere/common/ExportConfig.mdx'
2020-03-18 18:46:47 -04:00
### Optional:
2020-04-02 14:15:08 -04:00
@include 'builder/vsphere/common/ExportConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
#### Output Configuration:
2020-04-02 14:15:08 -04:00
@include 'builder/vsphere/common/OutputConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
## Working with Clusters
#### Standalone Hosts
Only use the `host` option. Optionally specify a `resource_pool`:
2020-03-31 18:47:06 -04:00
```text
2020-03-18 18:46:47 -04:00
"host": "esxi-1.vsphere65.test",
"resource_pool": "pool1",
```
#### Clusters Without DRS
Use the `cluster` and `host`parameters:
2020-03-31 18:47:06 -04:00
```text
2020-03-18 18:46:47 -04:00
"cluster": "cluster1",
"host": "esxi-2.vsphere65.test",
```
#### Clusters With DRS
Only use the `cluster` option. Optionally specify a `resource_pool`:
2020-03-31 18:47:06 -04:00
```text
2020-03-18 18:46:47 -04:00
"cluster": "cluster2",
"resource_pool": "pool1",
```
## Required vSphere Permissions
- VM folder (this object and children):
2020-03-27 14:22:33 -04:00
```text
2020-03-18 18:46:47 -04:00
Virtual machine -> Inventory
Virtual machine -> Configuration
Virtual machine -> Interaction
Virtual machine -> Snapshot management
Virtual machine -> Provisioning
```
Individual privileges are listed in https://github.com/jetbrains-infra/packer-builder-vsphere/issues/97#issuecomment-436063235.
- Resource pool, host, or cluster (this object):
2020-03-27 14:22:33 -04:00
```text
2020-03-18 18:46:47 -04:00
Resource -> Assign virtual machine to resource pool
```
- Host in clusters without DRS (this object):
2020-03-27 14:22:33 -04:00
```text
2020-03-18 18:46:47 -04:00
Read-only
```
- Datastore (this object):
2020-03-27 14:22:33 -04:00
```text
2020-03-18 18:46:47 -04:00
Datastore -> Allocate space
Datastore -> Browse datastore
Datastore -> Low level file operations
```
- Network (this object):
2020-03-27 14:22:33 -04:00
```text
2020-03-18 18:46:47 -04:00
Network -> Assign network
```
- Distributed switch (this object):
2020-03-27 14:22:33 -04:00
```text
2020-03-18 18:46:47 -04:00
Read-only
```
For floppy image upload:
- Datacenter (this object):
2020-03-27 14:22:33 -04:00
```text
2020-03-18 18:46:47 -04:00
Datastore -> Low level file operations
```
- Host (this object):
2020-03-27 14:22:33 -04:00
```text
2020-03-18 18:46:47 -04:00
Host -> Configuration -> System Management
```