Skip to content

Packer Plugin for VMware vSphere

The Packer Plugin for VMware vSphere is a plugin for creating virtual machine images for use with VMware vSphere®.

Installation

To install this plugin add this code into your Packer configuration and run packer init

packer {
  required_plugins {
    vsphere = {
      version = "~> 1"
      source  = "github.com/vmware/vsphere"
    }
  }
}

Alternatively, you can use packer plugins install to manage installation of this plugin.

packer plugins install github.com/vmware/vsphere

Components

The plugin includes builders, post-processors, and data sources for creating virtual machine images, depending on your desired strategy:

Builders

  • vsphere-iso - This builder starts from an ISO file and uses the vSphere API to build a virtual machine image on an ESX host.

  • vsphere-clone - This builder clones a virtual machine from an existing template using the uses the vSphere API and then modifies and saves it as a new template.

  • vsphere-supervisor - This builder deploys and publishes new virtual machine to a vSphere Supervisor cluster using VM Service.

Post-Processors

  • vsphere - This post-processor uploads an artifact to a vSphere endpoint. The artifact must be a VMX, OVA, or OVF file.

  • vsphere-template - This post-processor uses an artifact from the vSphere post-processor. It then marks the virtual machine as a template and moves it to your specified path.

Data Sources

  • Compute Cluster - This data source retrieves information about existing compute clusters from vSphere and returns the name, managed object ID, and root resource pool path for a cluster that matches all specified filters. The result can be used with the builders to set cluster.

  • Content Library - This data source retrieves information about an existing content library from vSphere and returns the name and unique identifier for a library that matches all specified filters.

  • Content Library Item - This data source retrieves information about an existing item in a content library from vSphere and returns the name, unique identifier, library, type, and content library path for an item that matches all specified filters.

  • Datastore - This data source retrieves information about existing datastores from vSphere and returns the name, managed object ID, and summary capacity fields for a datastore that matches all specified filters. The result can be used with the builders to set datastore.

  • Datastore Cluster - This data source retrieves information about existing datastore clusters from vSphere and returns the name, managed object ID, member datastore names, and aggregate summary capacity fields for a cluster that matches all specified filters. The result can be used with the builders to set datastore_cluster.

  • Host - This data source retrieves information about existing ESX hosts from vSphere and returns the name, managed object ID, parent compute cluster, and summary memory capacity fields for a host that matches all specified filters. The result can be used with the builders to set host.

  • Network - This data source retrieves information about existing networks from vSphere and returns the name, managed object ID, and API managed-object type for a network that matches all specified filters. The result can be used with the builders to set network.

  • Resource Pool - This data source retrieves information about existing resource pools from vSphere and returns the name, managed object ID, and builder-ready nested path for a pool that matches all specified filters. The result can be used with the builders and post-processors to set resource_pool.

  • Virtual Machine - This data source retrieves information about existing virtual machines from vSphere and returns the name of a virtual machine that matches all specified filters. This virtual machine can be used in the vSphere Clone builder to select a template.

Requirements

The plugin supports versions in accordance with the Broadcom Product Lifecycle.

Support

The plugin is supported by the project maintainers and the plugin community.