common

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: MPL-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "jetbrains.vsphere"

Variables

This section is empty.

Functions

func CleanupVM added in v1.6.5

func CleanupVM(state multistep.StateBag)

func CommHost

func CommHost(host string) func(multistep.StateBag) (string, error)

func GetRemoteDirectoryAndPath added in v1.6.5

func GetRemoteDirectoryAndPath(path string, ds driver.Datastore) (string, string, string, string)

Types

type Artifact

type Artifact struct {
	Outconfig *OutputConfig
	Name      string
	VM        *driver.VirtualMachineDriver

	// StateData should store data such as GeneratedData
	// to be shared with post-processors
	StateData map[string]interface{}
}

func (*Artifact) BuilderId

func (a *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 (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type BootConfig added in v1.6.1

type BootConfig struct {
	bootcommand.BootConfig `mapstructure:",squash"`
	// The IP address to use for the HTTP server started to serve the `http_directory`.
	// If unset, Packer will automatically discover and assign an IP.
	HTTPIP string `mapstructure:"http_ip"`
}

func (*BootConfig) Prepare added in v1.6.1

func (c *BootConfig) Prepare(ctx *interpolate.Context) []error

type CDRomConfig added in v1.6.3

type CDRomConfig struct {
	// Which controller to use. Example: `sata`. Defaults to `ide`.
	CdromType string `mapstructure:"cdrom_type"`
	// List of Datastore or Content Library paths to ISO files that will be mounted to the VM.
	// Here's an HCL2 example:
	// “`hcl
	// iso_paths = [
	//   "[datastore1] ISO/ubuntu.iso",
	//   "Packer Library Test/ubuntu-16.04.6-server-amd64/ubuntu-16.04.6-server-amd64.iso"
	// ]
	// “`
	ISOPaths []string `mapstructure:"iso_paths"`
}

func (*CDRomConfig) FlatMapstructure added in v1.6.3

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

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

func (*CDRomConfig) Prepare added in v1.6.3

func (c *CDRomConfig) Prepare() []error

type ConfigParamsConfig

type ConfigParamsConfig struct {
	// configuration_parameters is a direct passthrough to the VSphere API's
	// ConfigSpec: https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.ConfigSpec.html
	ConfigParams map[string]string `mapstructure:"configuration_parameters"`

	// Enables time synchronization with the host. Defaults to false.
	ToolsSyncTime bool `mapstructure:"tools_sync_time"`

	// If sets to true, vSphere will automatically check and upgrade VMware Tools upon a system power cycle.
	// If not set, defaults to manual upgrade.
	ToolsUpgradePolicy bool `mapstructure:"tools_upgrade_policy"`
}

func (*ConfigParamsConfig) FlatMapstructure

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

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

type ConnectConfig

type ConnectConfig struct {
	// vCenter server hostname.
	VCenterServer string `mapstructure:"vcenter_server"`
	// vSphere username.
	Username string `mapstructure:"username"`
	// vSphere password.
	Password string `mapstructure:"password"`
	// Do not validate vCenter server's TLS certificate. Defaults to `false`.
	InsecureConnection bool `mapstructure:"insecure_connection"`
	// VMware datacenter name. Required if there is more than one datacenter in vCenter.
	Datacenter string `mapstructure:"datacenter"`
}

func (*ConnectConfig) FlatMapstructure

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

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

func (*ConnectConfig) Prepare

func (c *ConnectConfig) Prepare() []error

type ContentLibraryDestinationConfig added in v1.6.1

type ContentLibraryDestinationConfig struct {
	// Name of the library in which the new library item containing the template should be created/updated.
	// The Content Library should be of type Local to allow deploying virtual machines.
	Library string `mapstructure:"library"`
	// Name of the library item that will be created or updated.
	// For VM templates, the name of the item should be different from [vm_name](#vm_name) and
	// the default is [vm_name](#vm_name) + timestamp when not set. VM templates will be always imported to a new library item.
	// For OVF templates, the name defaults to [vm_name](#vm_name) when not set, and if an item with the same name already
	// exists it will be then updated with the new OVF template, otherwise a new item will be created.
	//
	// ~> **Note**: It's not possible to update existing library items with a new VM template. If updating an existing library
	// item is necessary, use an OVF template instead by setting the [ovf](#ovf) option as `true`.
	//
	Name string `mapstructure:"name"`
	// Description of the library item that will be created.
	// This option is not used when importing OVF templates.
	// Defaults to "Packer imported [vm_name](#vm_name) VM template".
	Description string `mapstructure:"description"`
	// Cluster onto which the virtual machine template should be placed.
	// If cluster and resource_pool are both specified, resource_pool must belong to cluster.
	// If cluster and host are both specified, host must be a member of cluster.
	// This option is not used when importing OVF templates.
	// Defaults to [cluster](#cluster).
	Cluster string `mapstructure:"cluster"`
	// Virtual machine folder into which the virtual machine template should be placed.
	// This option is not used when importing OVF templates.
	// Defaults to the same folder as the source virtual machine.
	Folder string `mapstructure:"folder"`
	// Host onto which the virtual machine template should be placed.
	// If host and resource_pool are both specified, resource_pool must belong to host.
	// If host and cluster are both specified, host must be a member of cluster.
	// This option is not used when importing OVF templates.
	// Defaults to [host](#host).
	Host string `mapstructure:"host"`
	// Resource pool into which the virtual machine template should be placed.
	// Defaults to [resource_pool](#resource_pool). if [resource_pool](#resource_pool) is also unset,
	// the system will attempt to choose a suitable resource pool for the virtual machine template.
	ResourcePool string `mapstructure:"resource_pool"`
	// The datastore for the virtual machine template's configuration and log files.
	// This option is not used when importing OVF templates.
	// Defaults to the storage backing associated with the library specified by library.
	Datastore string `mapstructure:"datastore"`
	// If set to true, the VM will be destroyed after deploying the template to the Content Library.
	// Defaults to `false`.
	Destroy bool `mapstructure:"destroy"`
	// When set to true, Packer will import and OVF template to the content library item. Defaults to `false`.
	Ovf bool `mapstructure:"ovf"`
}

With this configuration Packer creates a library item in a content library whose content is a VM template or an OVF template created from the just built VM. The template is stored in a existing or newly created library item.

func (*ContentLibraryDestinationConfig) FlatMapstructure added in v1.6.1

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

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

func (*ContentLibraryDestinationConfig) Prepare added in v1.6.1

type DiskConfig added in v1.6.6

type DiskConfig struct {
	// The size of the disk in MB.
	DiskSize int64 `mapstructure:"disk_size" required:"true"`
	// Enable VMDK thin provisioning for VM. Defaults to `false`.
	DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"`
	// Enable VMDK eager scrubbing for VM. Defaults to `false`.
	DiskEagerlyScrub bool `mapstructure:"disk_eagerly_scrub"`
	// The assigned disk controller. Defaults to the first one (0)
	DiskControllerIndex int `mapstructure:"disk_controller_index"`
}

Defines the disk storage for a VM.

Example that will create a 15GB and a 20GB disk on the VM. The second disk will be thin provisioned:

In JSON: ```json

"storage": [
  {
    "disk_size": 15000
  },
  {
    "disk_size": 20000,
    "disk_thin_provisioned": true
  }
],

``` In HCL2: ```hcl

storage {
    disk_size = 15000
}
storage {
    disk_size = 20000
    disk_thin_provisioned = true
}

```

Example that creates 2 pvscsi controllers and adds 2 disks to each one:

In JSON: ```json

"disk_controller_type": ["pvscsi", "pvscsi"],
"storage": [
  {
    "disk_size": 15000,
    "disk_controller_index": 0
  },
  {
    "disk_size": 15000,
    "disk_controller_index": 0
  },
  {
    "disk_size": 15000,
    "disk_controller_index": 1
  },
  {
    "disk_size": 15000,
    "disk_controller_index": 1
  }
],

```

In HCL2: ```hcl

disk_controller_type = ["pvscsi", "pvscsi"]
storage {
   disk_size = 15000,
   disk_controller_index = 0
}
storage {
   disk_size = 15000
   disk_controller_index = 0
}
storage {
   disk_size = 15000
   disk_controller_index = 1
}
storage {
   disk_size = 15000
   disk_controller_index = 1
}

```

func (*DiskConfig) FlatMapstructure added in v1.6.6

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

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

type DownloadStep added in v1.6.5

type DownloadStep interface {
	Run(context.Context, multistep.StateBag) multistep.StepAction
	Cleanup(multistep.StateBag)
	UseSourceToFindCacheTarget(source string) (*url.URL, string, error)
}

Defining this interface ensures that we use the common step download, or the mock created to test this wrapper

type ExportConfig added in v1.5.5

type ExportConfig struct {
	// name of the ovf. defaults to the name of the VM
	Name string `mapstructure:"name"`
	// overwrite ovf if it exists
	Force bool `mapstructure:"force"`
	// include iso and img image files that are attached to the VM
	Images bool `mapstructure:"images"`
	// generate manifest using sha1, sha256, sha512. Defaults to 'sha256'. Use 'none' for no manifest.
	Manifest string `mapstructure:"manifest"`
	// Directory on the computer running Packer to export files to
	OutputDir OutputConfig `mapstructure:",squash"`
	// Advanced ovf export options. Options can include:
	// * mac - MAC address is exported for all ethernet devices
	// * uuid - UUID is exported for all virtual machines
	// * extraconfig - all extra configuration options are exported for a virtual machine
	// * nodevicesubtypes - resource subtypes for CD/DVD drives, floppy drives, and serial and parallel ports are not exported
	//
	// For example, adding the following export config option would output the mac addresses for all Ethernet devices in the ovf file:
	//
	// In JSON:
	// “`json
	// ...
	//   "export": {
	//     "options": ["mac"]
	//   },
	// “`
	// In HCL2:
	// “`hcl
	// ...
	//   export {
	//     options = ["mac"]
	//   }
	// “`
	Options []string `mapstructure:"options"`
}

You may optionally export an ovf from VSphere to the instance running Packer.

Example usage:

In JSON: ```json ...

"vm_name": "example-ubuntu",

...

"export": {
  "force": true,
  "output_directory": "./output_vsphere"
},

``` In HCL2: ```hcl

# ...
vm_name = "example-ubuntu"
# ...
export {
  force = true
  output_directory = "./output_vsphere"
}

``` The above configuration would create the following files:

```text ./output_vsphere/example-ubuntu-disk-0.vmdk ./output_vsphere/example-ubuntu.mf ./output_vsphere/example-ubuntu.ovf ```

func (*ExportConfig) FlatMapstructure added in v1.5.5

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

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

func (*ExportConfig) Prepare added in v1.5.5

type FlatCDRomConfig added in v1.6.3

type FlatCDRomConfig struct {
	CdromType *string  `mapstructure:"cdrom_type" cty:"cdrom_type" hcl:"cdrom_type"`
	ISOPaths  []string `mapstructure:"iso_paths" cty:"iso_paths" hcl:"iso_paths"`
}

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

func (*FlatCDRomConfig) HCL2Spec added in v1.6.3

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

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

type FlatConfigParamsConfig

type FlatConfigParamsConfig struct {
	ConfigParams       map[string]string `mapstructure:"configuration_parameters" cty:"configuration_parameters" hcl:"configuration_parameters"`
	ToolsSyncTime      *bool             `mapstructure:"tools_sync_time" cty:"tools_sync_time" hcl:"tools_sync_time"`
	ToolsUpgradePolicy *bool             `mapstructure:"tools_upgrade_policy" cty:"tools_upgrade_policy" hcl:"tools_upgrade_policy"`
}

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

func (*FlatConfigParamsConfig) HCL2Spec

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

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

type FlatConnectConfig

type FlatConnectConfig struct {
	VCenterServer      *string `mapstructure:"vcenter_server" cty:"vcenter_server" hcl:"vcenter_server"`
	Username           *string `mapstructure:"username" cty:"username" hcl:"username"`
	Password           *string `mapstructure:"password" cty:"password" hcl:"password"`
	InsecureConnection *bool   `mapstructure:"insecure_connection" cty:"insecure_connection" hcl:"insecure_connection"`
	Datacenter         *string `mapstructure:"datacenter" cty:"datacenter" hcl:"datacenter"`
}

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

func (*FlatConnectConfig) HCL2Spec

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

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

type FlatContentLibraryDestinationConfig added in v1.6.1

type FlatContentLibraryDestinationConfig struct {
	Library      *string `mapstructure:"library" cty:"library" hcl:"library"`
	Name         *string `mapstructure:"name" cty:"name" hcl:"name"`
	Description  *string `mapstructure:"description" cty:"description" hcl:"description"`
	Cluster      *string `mapstructure:"cluster" cty:"cluster" hcl:"cluster"`
	Folder       *string `mapstructure:"folder" cty:"folder" hcl:"folder"`
	Host         *string `mapstructure:"host" cty:"host" hcl:"host"`
	ResourcePool *string `mapstructure:"resource_pool" cty:"resource_pool" hcl:"resource_pool"`
	Datastore    *string `mapstructure:"datastore" cty:"datastore" hcl:"datastore"`
	Destroy      *bool   `mapstructure:"destroy" cty:"destroy" hcl:"destroy"`
	Ovf          *bool   `mapstructure:"ovf" cty:"ovf" hcl:"ovf"`
}

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

func (*FlatContentLibraryDestinationConfig) HCL2Spec added in v1.6.1

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

type FlatDiskConfig added in v1.6.6

type FlatDiskConfig struct {
	DiskSize            *int64 `mapstructure:"disk_size" required:"true" cty:"disk_size" hcl:"disk_size"`
	DiskThinProvisioned *bool  `mapstructure:"disk_thin_provisioned" cty:"disk_thin_provisioned" hcl:"disk_thin_provisioned"`
	DiskEagerlyScrub    *bool  `mapstructure:"disk_eagerly_scrub" cty:"disk_eagerly_scrub" hcl:"disk_eagerly_scrub"`
	DiskControllerIndex *int   `mapstructure:"disk_controller_index" cty:"disk_controller_index" hcl:"disk_controller_index"`
}

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

func (*FlatDiskConfig) HCL2Spec added in v1.6.6

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

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

type FlatExportConfig added in v1.5.5

type FlatExportConfig struct {
	Name      *string      `mapstructure:"name" cty:"name" hcl:"name"`
	Force     *bool        `mapstructure:"force" cty:"force" hcl:"force"`
	Images    *bool        `mapstructure:"images" cty:"images" hcl:"images"`
	Manifest  *string      `mapstructure:"manifest" cty:"manifest" hcl:"manifest"`
	OutputDir *string      `mapstructure:"output_directory" required:"false" cty:"output_directory" hcl:"output_directory"`
	DirPerm   *fs.FileMode `mapstructure:"directory_permission" required:"false" cty:"directory_permission" hcl:"directory_permission"`
	Options   []string     `mapstructure:"options" cty:"options" hcl:"options"`
}

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

func (*FlatExportConfig) HCL2Spec added in v1.5.5

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

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

type FlatFloppyConfig added in v1.6.3

type FlatFloppyConfig struct {
	FloppyIMGPath     *string  `mapstructure:"floppy_img_path" cty:"floppy_img_path" hcl:"floppy_img_path"`
	FloppyFiles       []string `mapstructure:"floppy_files" cty:"floppy_files" hcl:"floppy_files"`
	FloppyDirectories []string `mapstructure:"floppy_dirs" cty:"floppy_dirs" hcl:"floppy_dirs"`
	FloppyLabel       *string  `mapstructure:"floppy_label" cty:"floppy_label" hcl:"floppy_label"`
}

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

func (*FlatFloppyConfig) HCL2Spec added in v1.6.3

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

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

type FlatHardwareConfig

type FlatHardwareConfig struct {
	CPUs                *int32  `mapstructure:"CPUs" cty:"CPUs" hcl:"CPUs"`
	CpuCores            *int32  `mapstructure:"cpu_cores" cty:"cpu_cores" hcl:"cpu_cores"`
	CPUReservation      *int64  `mapstructure:"CPU_reservation" cty:"CPU_reservation" hcl:"CPU_reservation"`
	CPULimit            *int64  `mapstructure:"CPU_limit" cty:"CPU_limit" hcl:"CPU_limit"`
	CpuHotAddEnabled    *bool   `mapstructure:"CPU_hot_plug" cty:"CPU_hot_plug" hcl:"CPU_hot_plug"`
	RAM                 *int64  `mapstructure:"RAM" cty:"RAM" hcl:"RAM"`
	RAMReservation      *int64  `mapstructure:"RAM_reservation" cty:"RAM_reservation" hcl:"RAM_reservation"`
	RAMReserveAll       *bool   `mapstructure:"RAM_reserve_all" cty:"RAM_reserve_all" hcl:"RAM_reserve_all"`
	MemoryHotAddEnabled *bool   `mapstructure:"RAM_hot_plug" cty:"RAM_hot_plug" hcl:"RAM_hot_plug"`
	VideoRAM            *int64  `mapstructure:"video_ram" cty:"video_ram" hcl:"video_ram"`
	VGPUProfile         *string `mapstructure:"vgpu_profile" cty:"vgpu_profile" hcl:"vgpu_profile"`
	NestedHV            *bool   `mapstructure:"NestedHV" cty:"NestedHV" hcl:"NestedHV"`
	Firmware            *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
	ForceBIOSSetup      *bool   `mapstructure:"force_bios_setup" cty:"force_bios_setup" hcl:"force_bios_setup"`
}

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

func (*FlatHardwareConfig) HCL2Spec

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

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

type FlatLocationConfig

type FlatLocationConfig struct {
	VMName                     *string `mapstructure:"vm_name" cty:"vm_name" hcl:"vm_name"`
	Folder                     *string `mapstructure:"folder" cty:"folder" hcl:"folder"`
	Cluster                    *string `mapstructure:"cluster" cty:"cluster" hcl:"cluster"`
	Host                       *string `mapstructure:"host" cty:"host" hcl:"host"`
	ResourcePool               *string `mapstructure:"resource_pool" cty:"resource_pool" hcl:"resource_pool"`
	Datastore                  *string `mapstructure:"datastore" cty:"datastore" hcl:"datastore"`
	SetHostForDatastoreUploads *bool   `mapstructure:"set_host_for_datastore_uploads" cty:"set_host_for_datastore_uploads" hcl:"set_host_for_datastore_uploads"`
}

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

func (*FlatLocationConfig) HCL2Spec

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

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

type FlatOutputConfig added in v1.5.5

type FlatOutputConfig struct {
	OutputDir *string      `mapstructure:"output_directory" required:"false" cty:"output_directory" hcl:"output_directory"`
	DirPerm   *fs.FileMode `mapstructure:"directory_permission" required:"false" cty:"directory_permission" hcl:"directory_permission"`
}

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

func (*FlatOutputConfig) HCL2Spec added in v1.5.5

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

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

type FlatRemoveCDRomConfig added in v1.6.3

type FlatRemoveCDRomConfig struct {
	RemoveCdrom *bool `mapstructure:"remove_cdrom" cty:"remove_cdrom" hcl:"remove_cdrom"`
}

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

func (*FlatRemoveCDRomConfig) HCL2Spec added in v1.6.3

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

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

type FlatRunConfig

type FlatRunConfig struct {
	BootOrder *string `mapstructure:"boot_order" cty:"boot_order" hcl:"boot_order"`
}

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

func (*FlatRunConfig) HCL2Spec

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

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

type FlatShutdownConfig

type FlatShutdownConfig struct {
	Command         *string `mapstructure:"shutdown_command" cty:"shutdown_command" hcl:"shutdown_command"`
	Timeout         *string `mapstructure:"shutdown_timeout" cty:"shutdown_timeout" hcl:"shutdown_timeout"`
	DisableShutdown *bool   `mapstructure:"disable_shutdown" cty:"disable_shutdown" hcl:"disable_shutdown"`
}

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

func (*FlatShutdownConfig) HCL2Spec

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

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

type FlatStorageConfig added in v1.6.6

type FlatStorageConfig struct {
	DiskControllerType []string         `mapstructure:"disk_controller_type" cty:"disk_controller_type" hcl:"disk_controller_type"`
	Storage            []FlatDiskConfig `mapstructure:"storage" cty:"storage" hcl:"storage"`
}

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

func (*FlatStorageConfig) HCL2Spec added in v1.6.6

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

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

type FlatWaitIpConfig

type FlatWaitIpConfig struct {
	WaitTimeout   *string `mapstructure:"ip_wait_timeout" cty:"ip_wait_timeout" hcl:"ip_wait_timeout"`
	SettleTimeout *string `mapstructure:"ip_settle_timeout" cty:"ip_settle_timeout" hcl:"ip_settle_timeout"`
	WaitAddress   *string `mapstructure:"ip_wait_address" cty:"ip_wait_address" hcl:"ip_wait_address"`
}

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

func (*FlatWaitIpConfig) HCL2Spec

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

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

type FloppyConfig added in v1.6.3

type FloppyConfig struct {
	// Datastore path to a floppy image that will be mounted to the VM.
	// Example: `[datastore1] ISO/pvscsi-Windows8.flp`.
	FloppyIMGPath string `mapstructure:"floppy_img_path"`
	// List of local files to be mounted to the VM floppy drive. Can be used to
	// make Debian preseed or RHEL kickstart files available to the VM.
	FloppyFiles []string `mapstructure:"floppy_files"`
	// List of directories to copy files from.
	FloppyDirectories []string `mapstructure:"floppy_dirs"`
	// The label to use for the floppy disk that
	// is attached when the VM is booted. This is most useful for cloud-init,
	// Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
	// By default, the floppy label will be 'packer'.
	FloppyLabel string `mapstructure:"floppy_label"`
}

func (*FloppyConfig) FlatMapstructure added in v1.6.3

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

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

type HardwareConfig

type HardwareConfig struct {
	// Number of CPU cores.
	CPUs int32 `mapstructure:"CPUs"`
	// Number of CPU cores per socket.
	CpuCores int32 `mapstructure:"cpu_cores"`
	// Amount of reserved CPU resources in MHz.
	CPUReservation int64 `mapstructure:"CPU_reservation"`
	// Upper limit of available CPU resources in MHz.
	CPULimit int64 `mapstructure:"CPU_limit"`
	// Enable CPU hot plug setting for virtual machine. Defaults to `false`.
	CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"`
	// Amount of RAM in MB.
	RAM int64 `mapstructure:"RAM"`
	// Amount of reserved RAM in MB.
	RAMReservation int64 `mapstructure:"RAM_reservation"`
	// Reserve all available RAM. Defaults to `false`. Cannot be used together
	// with `RAM_reservation`.
	RAMReserveAll bool `mapstructure:"RAM_reserve_all"`
	// Enable RAM hot plug setting for virtual machine. Defaults to `false`.
	MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"`
	// Amount of video memory in KB.
	VideoRAM int64 `mapstructure:"video_ram"`
	// vGPU profile for accelerated graphics. See [NVIDIA GRID vGPU documentation](https://docs.nvidia.com/grid/latest/grid-vgpu-user-guide/index.html#configure-vmware-vsphere-vm-with-vgpu)
	// for examples of profile names. Defaults to none.
	VGPUProfile string `mapstructure:"vgpu_profile"`
	// Enable nested hardware virtualization for VM. Defaults to `false`.
	NestedHV bool `mapstructure:"NestedHV"`
	// Set the Firmware for virtual machine. Supported values: `bios`, `efi` or `efi-secure`. Defaults to `bios`.
	Firmware string `mapstructure:"firmware"`
	// During the boot, force entry into the BIOS setup screen. Defaults to `false`.
	ForceBIOSSetup bool `mapstructure:"force_bios_setup"`
}

func (*HardwareConfig) FlatMapstructure

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

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

func (*HardwareConfig) Prepare

func (c *HardwareConfig) Prepare() []error

type LocationConfig

type LocationConfig struct {
	// Name of the new VM to create.
	VMName string `mapstructure:"vm_name"`
	// VM folder to create the VM in.
	Folder string `mapstructure:"folder"`
	// ESXi cluster where target VM is created. See the
	// [Working With Clusters And Hosts](#working-with-clusters-and-hosts)
	// section above for more details.
	Cluster string `mapstructure:"cluster"`
	// ESXi host where target VM is created. A full path must be specified if
	// the host is in a folder. For example `folder/host`. See the
	// [Working With Clusters And Hosts](#working-with-clusters-and-hosts)
	// section above for more details.
	Host string `mapstructure:"host"`
	// VMWare resource pool. If not set, it will look for the root resource
	// pool of the `host` or `cluster`. If a root resource is not found, it
	// will then look for a default resource pool.
	ResourcePool string `mapstructure:"resource_pool"`
	// VMWare datastore. Required if `host` is a cluster, or if `host` has
	// multiple datastores.
	Datastore string `mapstructure:"datastore"`
	// Set this to true if packer should use the host for uploading files
	// to the datastore. Defaults to false.
	SetHostForDatastoreUploads bool `mapstructure:"set_host_for_datastore_uploads"`
}

func (*LocationConfig) FlatMapstructure

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

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

func (*LocationConfig) Prepare

func (c *LocationConfig) Prepare() []error

type OutputConfig added in v1.5.5

type OutputConfig struct {
	// This setting specifies the directory that
	// artifacts from the build, such as the virtual machine files and disks,
	// will be output to. The path to the directory may be relative or
	// absolute. If relative, the path is relative to the working directory
	// packer is executed from. This directory must not exist or, if
	// created, must be empty prior to running the builder. By default this is
	// "output-BUILDNAME" where "BUILDNAME" is the name of the build.
	OutputDir string `mapstructure:"output_directory" required:"false"`
	// The permissions to apply to the "output_directory", and to any parent
	// directories that get created for output_directory.  By default this is
	// "0750". You should express the permission as quoted string with a
	// leading zero such as "0755" in JSON file, because JSON does not support
	// octal value. In Unix-like OS, the actual permission may differ from
	// this value because of umask.
	DirPerm os.FileMode `mapstructure:"directory_permission" required:"false"`
}

func (*OutputConfig) FlatMapstructure added in v1.5.5

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

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

func (*OutputConfig) ListFiles added in v1.5.6

func (c *OutputConfig) ListFiles() ([]string, error)

Stolen from output_dir_local.go in vmware builder.

func (*OutputConfig) Prepare added in v1.5.5

func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error

type RemoveCDRomConfig added in v1.6.3

type RemoveCDRomConfig struct {
	// Remove CD-ROM devices from template. Defaults to `false`.
	RemoveCdrom bool `mapstructure:"remove_cdrom"`
}

func (*RemoveCDRomConfig) FlatMapstructure added in v1.6.3

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

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

type RunConfig

type RunConfig struct {
	// Priority of boot devices. Defaults to `disk,cdrom`
	BootOrder string `mapstructure:"boot_order"` // example: "floppy,cdrom,ethernet,disk"
}

func (*RunConfig) FlatMapstructure

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

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

type ShutdownConfig

type ShutdownConfig struct {
	// Specify a VM guest shutdown command. This command will be executed using
	// the `communicator`. Otherwise the VMware guest tools are used to gracefully
	// shutdown the VM guest.
	Command string `mapstructure:"shutdown_command"`
	// Amount of time to wait for graceful VM shutdown.
	// Defaults to 5m or five minutes.
	// This will likely need to be modified if the `communicator` is 'none'.
	Timeout time.Duration `mapstructure:"shutdown_timeout"`
	// Packer normally halts the virtual machine after all provisioners have
	// run when no `shutdown_command` is defined. If this is set to `true`, Packer
	// *will not* halt the virtual machine but will assume that you will send the stop
	// signal yourself through a preseed.cfg, a script or the final provisioner.
	// Packer will wait for a default of five minutes until the virtual machine is shutdown.
	// The timeout can be changed using `shutdown_timeout` option.
	DisableShutdown bool `mapstructure:"disable_shutdown"`
}

func (*ShutdownConfig) FlatMapstructure

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

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

func (*ShutdownConfig) Prepare

func (c *ShutdownConfig) Prepare(comm communicator.Config) (warnings []string, errs []error)

type StepAddCDRom added in v1.6.3

type StepAddCDRom struct {
	Config *CDRomConfig
}

func (*StepAddCDRom) Cleanup added in v1.6.3

func (s *StepAddCDRom) Cleanup(state multistep.StateBag)

func (*StepAddCDRom) Run added in v1.6.3

type StepAddFloppy added in v1.6.3

type StepAddFloppy struct {
	Config                     *FloppyConfig
	Datastore                  string
	Host                       string
	SetHostForDatastoreUploads bool
}

func (*StepAddFloppy) Cleanup added in v1.6.3

func (s *StepAddFloppy) Cleanup(state multistep.StateBag)

func (*StepAddFloppy) Run added in v1.6.3

type StepBootCommand added in v1.6.1

type StepBootCommand struct {
	Config *BootConfig
	VMName string
	Ctx    interpolate.Context
}

func (*StepBootCommand) Cleanup added in v1.6.1

func (s *StepBootCommand) Cleanup(_ multistep.StateBag)

func (*StepBootCommand) Run added in v1.6.1

type StepConfigParams

type StepConfigParams struct {
	Config *ConfigParamsConfig
}

func (*StepConfigParams) Cleanup

func (s *StepConfigParams) Cleanup(state multistep.StateBag)

func (*StepConfigParams) Run

type StepConfigureHardware

type StepConfigureHardware struct {
	Config *HardwareConfig
}

func (*StepConfigureHardware) Cleanup

func (*StepConfigureHardware) Run

type StepConnect

type StepConnect struct {
	Config *ConnectConfig
}

func (*StepConnect) Cleanup

func (s *StepConnect) Cleanup(multistep.StateBag)

func (*StepConnect) Run

type StepConvertToTemplate

type StepConvertToTemplate struct {
	ConvertToTemplate bool
}

func (*StepConvertToTemplate) Cleanup

func (s *StepConvertToTemplate) Cleanup(state multistep.StateBag)

func (*StepConvertToTemplate) Run

type StepCreateSnapshot

type StepCreateSnapshot struct {
	CreateSnapshot bool
}

func (*StepCreateSnapshot) Cleanup

func (s *StepCreateSnapshot) Cleanup(state multistep.StateBag)

func (*StepCreateSnapshot) Run

type StepDownload added in v1.6.5

type StepDownload struct {
	DownloadStep DownloadStep
	// These keys are VSphere-specific and used to check the remote datastore.
	Url       []string
	ResultKey string
	Datastore string
	Host      string
}

VSphere has a specialized need -- before we waste time downloading an iso, we need to check whether that iso already exists on the remote datastore. if it does, we skip the download. This wrapping-step still uses the common StepDownload but only if the image isn't already present on the datastore.

func (*StepDownload) Cleanup added in v1.6.5

func (s *StepDownload) Cleanup(state multistep.StateBag)

func (*StepDownload) Run added in v1.6.5

type StepExport added in v1.5.5

type StepExport struct {
	Name      string
	Force     bool
	Images    bool
	Manifest  string
	OutputDir string
	Options   []string
	// contains filtered or unexported fields
}

func (*StepExport) Cleanup added in v1.5.5

func (s *StepExport) Cleanup(multistep.StateBag)

func (*StepExport) Download added in v1.5.5

func (s *StepExport) Download(ctx context.Context, lease *nfc.Lease, item nfc.FileItem) (int64, error)

func (*StepExport) Run added in v1.5.5

type StepHTTPIPDiscover added in v1.6.1

type StepHTTPIPDiscover struct {
	HTTPIP  string
	Network *net.IPNet
}

Step to discover the http ip which guests use to reach the vm host To make sure the IP is set before boot command and http server steps

func (*StepHTTPIPDiscover) Cleanup added in v1.6.1

func (s *StepHTTPIPDiscover) Cleanup(state multistep.StateBag)

func (*StepHTTPIPDiscover) Run added in v1.6.1

type StepImportToContentLibrary added in v1.6.1

type StepImportToContentLibrary struct {
	ContentLibConfig *ContentLibraryDestinationConfig
}

func (*StepImportToContentLibrary) Cleanup added in v1.6.1

func (*StepImportToContentLibrary) Run added in v1.6.1

type StepRemoteUpload added in v1.6.3

type StepRemoteUpload struct {
	Datastore                  string
	Host                       string
	SetHostForDatastoreUploads bool
	UploadedCustomCD           bool
}

func (*StepRemoteUpload) Cleanup added in v1.6.3

func (s *StepRemoteUpload) Cleanup(state multistep.StateBag)

func (*StepRemoteUpload) Run added in v1.6.3

type StepRemoveCDRom added in v1.6.3

type StepRemoveCDRom struct {
	Config *RemoveCDRomConfig
}

func (*StepRemoveCDRom) Cleanup added in v1.6.3

func (s *StepRemoveCDRom) Cleanup(state multistep.StateBag)

func (*StepRemoveCDRom) Run added in v1.6.3

type StepRemoveFloppy added in v1.6.3

type StepRemoveFloppy struct {
	Datastore string
	Host      string
}

func (*StepRemoveFloppy) Cleanup added in v1.6.3

func (s *StepRemoveFloppy) Cleanup(state multistep.StateBag)

func (*StepRemoveFloppy) Run added in v1.6.3

type StepRun

type StepRun struct {
	Config   *RunConfig
	SetOrder bool
}

func (*StepRun) Cleanup

func (s *StepRun) Cleanup(state multistep.StateBag)

func (*StepRun) Run

type StepShutdown

type StepShutdown struct {
	Config *ShutdownConfig
}

func (*StepShutdown) Cleanup

func (s *StepShutdown) Cleanup(state multistep.StateBag)

func (*StepShutdown) Run

type StepSshKeyPair added in v1.6.1

type StepSshKeyPair struct {
	Debug        bool
	DebugKeyPath string
	Comm         *communicator.Config
}

StepSshKeyPair executes the business logic for setting the SSH key pair in the specified communicator.Config.

func (*StepSshKeyPair) Cleanup added in v1.6.1

func (s *StepSshKeyPair) Cleanup(state multistep.StateBag)

func (*StepSshKeyPair) Run added in v1.6.1

type StepWaitForIp

type StepWaitForIp struct {
	Config *WaitIpConfig
}

func (*StepWaitForIp) Cleanup

func (s *StepWaitForIp) Cleanup(state multistep.StateBag)

func (*StepWaitForIp) Run

type StorageConfig added in v1.6.6

type StorageConfig struct {
	// Set VM disk controller type. Example `lsilogic`, `pvscsi`, `nvme`, or `scsi`. Use a list to define additional controllers.
	// Defaults to `lsilogic`. See
	// [SCSI, SATA, and NVMe Storage Controller Conditions, Limitations, and Compatibility](https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-5872D173-A076-42FE-8D0B-9DB0EB0E7362.html#GUID-5872D173-A076-42FE-8D0B-9DB0EB0E7362)
	// for additional details.
	DiskControllerType []string `mapstructure:"disk_controller_type"`
	// Configures a collection of one or more disks to be provisioned along with the VM. See the [Storage Configuration](#storage-configuration).
	Storage []DiskConfig `mapstructure:"storage"`
}

func (*StorageConfig) FlatMapstructure added in v1.6.6

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

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

func (*StorageConfig) Prepare added in v1.6.6

func (c *StorageConfig) Prepare() []error

type WaitIpConfig

type WaitIpConfig struct {
	// Amount of time to wait for VM's IP, similar to 'ssh_timeout'.
	// Defaults to 30m (30 minutes). See the Golang
	// [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation
	// for full details.
	WaitTimeout time.Duration `mapstructure:"ip_wait_timeout"`
	// Amount of time to wait for VM's IP to settle down, sometimes VM may
	// report incorrect IP initially, then its recommended to set that
	// parameter to apx. 2 minutes. Examples 45s and 10m. Defaults to
	// 5s(5 seconds). See the Golang
	// [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation
	//  for full details.
	SettleTimeout time.Duration `mapstructure:"ip_settle_timeout"`
	// Set this to a CIDR address to cause the service to wait for an address that is contained in
	// this network range. Defaults to "0.0.0.0/0" for any ipv4 address. Examples include:
	//
	// * empty string ("") - remove all filters
	// * `0:0:0:0:0:0:0:0/0` - allow only ipv6 addresses
	// * `192.168.1.0/24` - only allow ipv4 addresses from 192.168.1.1 to 192.168.1.254
	WaitAddress *string `mapstructure:"ip_wait_address"`
	// contains filtered or unexported fields
}

func (*WaitIpConfig) FlatMapstructure

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

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

func (*WaitIpConfig) GetIPNet added in v1.6.1

func (c *WaitIpConfig) GetIPNet() *net.IPNet

func (*WaitIpConfig) Prepare

func (c *WaitIpConfig) Prepare() []error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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