Skip to content

Commit

Permalink
add vsphere postprocessor example in json and hcl (hashicorp#9669)
Browse files Browse the repository at this point in the history
* add vsphere postprocessor example in json and hcl

* Update website/pages/docs/post-processors/vsphere.mdx

Co-authored-by: Adrien Delorme <[email protected]>
  • Loading branch information
SwampDragons and azr authored Jul 30, 2020
1 parent 568b3c1 commit 5b26f1b
Showing 1 changed file with 81 additions and 3 deletions.
84 changes: 81 additions & 3 deletions website/pages/docs/post-processors/vsphere.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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": "[email protected]"
}
]
]
}
```

</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 = "[email protected]"
}
}
}
```

</Tab>
</Tabs>

0 comments on commit 5b26f1b

Please sign in to comment.