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 <azr@users.noreply.github.com>
This commit is contained in:
Megan Marsh 2020-07-30 01:47:42 -07:00 committed by GitHub
parent 568b3c100c
commit 5b26f1b56d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 81 additions and 3 deletions

View File

@ -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.
<Tabs>
<Tab heading="JSON">
``` 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"
}
]
]
}
```
</Tab>
<Tab heading="HCL2">
```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"
}
}
}
```
</Tab>
</Tabs>