vsphere

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2024 License: MPL-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const BuilderId = "packer.post-processor.vsphere"
View Source
const DefaultDiskMode = "thick"
View Source
const DefaultMaxRetries = 5
View Source
const OvftoolWindows = "ovftool.exe"

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	// contains filtered or unexported fields
}

func NewArtifact

func NewArtifact(datastore, vmfolder, vmname string, files []string) *Artifact

func (*Artifact) BuilderId

func (*Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (a *Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State

func (*Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type Config

type Config struct {
	common.PackerConfig `mapstructure:",squash"`
	// The cluster or ESXi host to upload the virtual machine.
	// This can be either the name of the vSphere cluster or the fully qualified domain name (FQDN)
	// or IP address of the ESXi host.
	Cluster string `mapstructure:"cluster" required:"true"`
	// The name of the vSphere datacenter object to place the virtual machine.
	// This is _not required_ if `resource_pool` is specified.
	Datacenter string `mapstructure:"datacenter" required:"true"`
	// The name of the vSphere datastore to place the virtual machine.
	Datastore string `mapstructure:"datastore"  required:"true"`
	// The disk format of the target virtual machine. One of `thin`, `thick`,
	DiskMode string `mapstructure:"disk_mode"`
	// The fully qualified domain name or IP address of the vCenter Server or ESXi host.
	Host string `mapstructure:"host" required:"true"`
	// The fully qualified domain name or IP address of the ESXi host to upload the
	// virtual machine. This is _not required_ if `host` is a vCenter Server.
	ESXiHost string `mapstructure:"esxi_host"`
	// Skip the verification of the server certificate. Defaults to `false`.
	Insecure bool `mapstructure:"insecure"`
	// Options to send to `ovftool` when uploading the virtual machine.
	// Use `ovftool --help` to list all the options available.
	Options []string `mapstructure:"options"`
	// Overwrite existing files.
	// If `true`, forces overwrites of existing files. Defaults to `false`.
	Overwrite bool `mapstructure:"overwrite"`
	// The password to use to authenticate to the vSphere endpoint.
	Password string `mapstructure:"password" required:"true"`
	// The name of the resource pool to place the virtual machine.
	ResourcePool string `mapstructure:"resource_pool"`
	// The username to use to authenticate to the vSphere endpoint.
	Username string `mapstructure:"username" required:"true"`
	// The name of the virtual machine folder path where the virtual machine will be
	// placed.
	VMFolder string `mapstructure:"vm_folder"`
	// The name of the virtual machine to be created on the vSphere endpoint.
	VMName string `mapstructure:"vm_name"`
	// The name of the network in which to place the virtual machine.
	VMNetwork string `mapstructure:"vm_network"`
	// The maximum virtual hardware version for the deployed virtual machine.
	//
	// It does not upgrade the virtual hardware version of the source VM. Instead, it limits the
	// virtual hardware version of the deployed virtual machine  to the specified version.
	// If the source virtual machine's hardware version is higher than the specified version, the
	// deployed virtual machine's hardware version will be downgraded to the specified version.
	//
	// If the source virtual machine's hardware version is lower than or equal to the specified
	// version, the deployed virtual machine's hardware version will be the same as the source
	// virtual machine's.
	//
	// This option is useful when deploying to vCenter Server instance ot an ESXi host whose
	// version is different than the one used to create the artifact.
	//
	// Refer to [KB 315655](https://knowledge.broadcom.com/external/article?articleNumber=315655)
	// for more information on supported virtual hardware versions.
	HardwareVersion string `mapstructure:"hardware_version"`
	// The maximum number of times to retry the upload operation if it fails.
	// Defaults to `5`.
	MaxRetries int `mapstructure:"max_retries"`
	// contains filtered or unexported fields
}

func (*Config) FlatMapstructure

func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

type FlatConfig

type FlatConfig struct {
	PackerBuildName     *string           `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"`
	PackerBuilderType   *string           `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"`
	PackerCoreVersion   *string           `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"`
	PackerDebug         *bool             `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"`
	PackerForce         *bool             `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"`
	PackerOnError       *string           `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"`
	PackerUserVars      map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"`
	PackerSensitiveVars []string          `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"`
	Cluster             *string           `mapstructure:"cluster" required:"true" cty:"cluster" hcl:"cluster"`
	Datacenter          *string           `mapstructure:"datacenter" required:"true" cty:"datacenter" hcl:"datacenter"`
	Datastore           *string           `mapstructure:"datastore" required:"true" cty:"datastore" hcl:"datastore"`
	DiskMode            *string           `mapstructure:"disk_mode" cty:"disk_mode" hcl:"disk_mode"`
	Host                *string           `mapstructure:"host" required:"true" cty:"host" hcl:"host"`
	ESXiHost            *string           `mapstructure:"esxi_host" cty:"esxi_host" hcl:"esxi_host"`
	Insecure            *bool             `mapstructure:"insecure" cty:"insecure" hcl:"insecure"`
	Options             []string          `mapstructure:"options" cty:"options" hcl:"options"`
	Overwrite           *bool             `mapstructure:"overwrite" cty:"overwrite" hcl:"overwrite"`
	Password            *string           `mapstructure:"password" required:"true" cty:"password" hcl:"password"`
	ResourcePool        *string           `mapstructure:"resource_pool" cty:"resource_pool" hcl:"resource_pool"`
	Username            *string           `mapstructure:"username" required:"true" cty:"username" hcl:"username"`
	VMFolder            *string           `mapstructure:"vm_folder" cty:"vm_folder" hcl:"vm_folder"`
	VMName              *string           `mapstructure:"vm_name" cty:"vm_name" hcl:"vm_name"`
	VMNetwork           *string           `mapstructure:"vm_network" cty:"vm_network" hcl:"vm_network"`
	HardwareVersion     *string           `mapstructure:"hardware_version" cty:"hardware_version" hcl:"hardware_version"`
	MaxRetries          *int              `mapstructure:"max_retries" cty:"max_retries" hcl:"max_retries"`
}

FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatConfig) HCL2Spec

func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a Config. This spec is used by HCL to read the fields of Config. The decoded values from this spec will then be applied to a FlatConfig.

type PostProcessor

type PostProcessor struct {
	// contains filtered or unexported fields
}

func (*PostProcessor) BuildArgs

func (p *PostProcessor) BuildArgs(source, ovftoolURI string) ([]string, error)

func (*PostProcessor) ConfigSpec

func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec

func (*PostProcessor) Configure

func (p *PostProcessor) Configure(raws ...interface{}) error

func (*PostProcessor) PostProcess

func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packersdk.Artifact) (packersdk.Artifact, bool, bool, error)

func (*PostProcessor) ValidateOvfTool

func (p *PostProcessor) ValidateOvfTool(args []string, ofvtool string, ui packersdk.Ui) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL