Merge pull request #1091 from mkuzmin/vsphere-parameters
post-processors/vsphere: Optional parameters in vSphere post-processor
This commit is contained in:
commit
12d16cace1
|
@ -64,14 +64,11 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
templates := map[string]*string{
|
templates := map[string]*string{
|
||||||
"cluster": &p.config.Cluster,
|
"cluster": &p.config.Cluster,
|
||||||
"datacenter": &p.config.Datacenter,
|
"datacenter": &p.config.Datacenter,
|
||||||
"datastore": &p.config.Datastore,
|
|
||||||
"diskmode": &p.config.DiskMode,
|
"diskmode": &p.config.DiskMode,
|
||||||
"host": &p.config.Host,
|
"host": &p.config.Host,
|
||||||
"vm_network": &p.config.VMNetwork,
|
|
||||||
"password": &p.config.Password,
|
"password": &p.config.Password,
|
||||||
"resource_pool": &p.config.ResourcePool,
|
"resource_pool": &p.config.ResourcePool,
|
||||||
"username": &p.config.Username,
|
"username": &p.config.Username,
|
||||||
"vm_folder": &p.config.VMFolder,
|
|
||||||
"vm_name": &p.config.VMName,
|
"vm_name": &p.config.VMName,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +77,13 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
errs = packer.MultiErrorAppend(
|
errs = packer.MultiErrorAppend(
|
||||||
errs, fmt.Errorf("%s must be set", key))
|
errs, fmt.Errorf("%s must be set", key))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
templates ["datastore"] = &p.config.Datastore
|
||||||
|
templates ["vm_network"] = &p.config.VMNetwork
|
||||||
|
templates ["vm_folder"] = &p.config.VMFolder
|
||||||
|
|
||||||
|
for key, ptr := range templates {
|
||||||
*ptr, err = p.config.tpl.Process(*ptr, nil)
|
*ptr, err = p.config.tpl.Process(*ptr, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = packer.MultiErrorAppend(
|
errs = packer.MultiErrorAppend(
|
||||||
|
|
|
@ -23,8 +23,6 @@ Required:
|
||||||
* `datacenter` (string) - The name of the datacenter within vSphere to
|
* `datacenter` (string) - The name of the datacenter within vSphere to
|
||||||
add the VM to.
|
add the VM to.
|
||||||
|
|
||||||
* `datastore` (string) - The name of the datastore to store this VM.
|
|
||||||
|
|
||||||
* `host` (string) - The vSphere host that will be contacted to perform
|
* `host` (string) - The vSphere host that will be contacted to perform
|
||||||
the VM upload.
|
the VM upload.
|
||||||
|
|
||||||
|
@ -36,17 +34,19 @@ Required:
|
||||||
* `username` (string) - The username to use to authenticate to the vSphere
|
* `username` (string) - The username to use to authenticate to the vSphere
|
||||||
endpoint.
|
endpoint.
|
||||||
|
|
||||||
* `vm_folder` (string) - The folder within the datastore to store the VM.
|
|
||||||
|
|
||||||
* `vm_name` (string) - The name of the VM once it is uploaded.
|
* `vm_name` (string) - The name of the VM once it is uploaded.
|
||||||
|
|
||||||
* `vm_network` (string) - The name of the VM network this VM will be
|
|
||||||
added to.
|
|
||||||
|
|
||||||
Optional:
|
Optional:
|
||||||
|
|
||||||
|
* `datastore` (string) - The name of the datastore to store this VM.
|
||||||
|
|
||||||
* `disk_mode` (string) - Target disk format. See `ovftool` manual for
|
* `disk_mode` (string) - Target disk format. See `ovftool` manual for
|
||||||
available options. By default, "thick" will be used.
|
available options. By default, "thick" will be used.
|
||||||
|
|
||||||
* `insecure` (bool) - Whether or not the connection to vSphere can be done
|
* `insecure` (bool) - Whether or not the connection to vSphere can be done
|
||||||
over an insecure connection. By default this is false.
|
over an insecure connection. By default this is false.
|
||||||
|
|
||||||
|
* `vm_folder` (string) - The folder within the datastore to store the VM.
|
||||||
|
|
||||||
|
* `vm_network` (string) - The name of the VM network this VM will be
|
||||||
|
added to.
|
||||||
|
|
Loading…
Reference in New Issue