From 5b26f1b56d45de5347194047209cf4f5ad3ea66e Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 30 Jul 2020 01:47:42 -0700 Subject: [PATCH] add vsphere postprocessor example in json and hcl (#9669) * add vsphere postprocessor example in json and hcl * Update website/pages/docs/post-processors/vsphere.mdx Co-authored-by: Adrien Delorme --- .../pages/docs/post-processors/vsphere.mdx | 84 ++++++++++++++++++- 1 file changed, 81 insertions(+), 3 deletions(-) diff --git a/website/pages/docs/post-processors/vsphere.mdx b/website/pages/docs/post-processors/vsphere.mdx index 0da5093f1..b17d40da2 100644 --- a/website/pages/docs/post-processors/vsphere.mdx +++ b/website/pages/docs/post-processors/vsphere.mdx @@ -22,9 +22,9 @@ each category, the available configuration keys are alphabetized. Required: -- `cluster` (string) - The cluster to upload the VM to. If you do not have a - cluster defined, you can instead provide the IP address of the esx host - that you want to upload to. +- `cluster` (string) - The cluster or host to upload the VM to. This can be + either the name of the cluster, or the IP address of the esx host that you + want to upload to. - `datacenter` (string) - The name of the datacenter within vSphere to add the VM to. @@ -71,3 +71,81 @@ Optional: - `options` (array of strings) - Custom options to add in ovftool. See `ovftool --help` to list all the options + +# Example + +The following is an example of the vSphere post-processor being used in +conjunction with the null builder and artifice post-processor to upload a vmx +to a vSphere cluster. + +You can also use this post-processor with the vmx artifact from a vmware build. + + + + +``` json +{ + "builders": [ + { + "type": "null", + "communicator": "none" + } + ], + "post-processors": [ + [ + { + "type": "artifice", + "files":["output-vmware-iso/packer-vmware-iso.vmx"] + }, + { + "type": "vsphere", + "keep_input_artifact": true, + "vm_name": "packerparty", + "vm_network": "VM Network", + "cluster": "123.45.678.1", + "datacenter": "PackerDatacenter", + "datastore": "datastore1", + "host": "123.45.678.9", + "password": "SuperSecretPassword", + "username": "Administrator@vsphere.local" + } + ] + ] +} +``` + + + + +```hcl +source "null" "example" { + communicator = "none" +} + +build { + sources = [ + "source.null.example" + ] + + post-processors{ + post-processor "artifice"{ + files = ["output-vmware-iso/packer-vmware-iso.vmx"] + } + + post-processor "vsphere"{ + keep_input_artifact = true + vm_name = "packerparty" + vm_network = "VM Network" + cluster = "123.45.678.1" + datacenter = "PackerDatacenter" + datastore = "datastore1" + host = "123.45.678.9" + password = "SuperSecretPassword" + username = "Administrator@vsphere.local" + } + } +} +``` + + +