Documentation
¶
Index ¶
- Constants
- func CleanupVM(state multistep.StateBag)
- func CommHost(host string) func(multistep.StateBag) (string, error)
- func GetRemoteDirectoryAndPath(path string, ds driver.Datastore) (string, string, string, string)
- func GetVMMetadata(vm *driver.VirtualMachineDriver, state multistep.StateBag) map[string]string
- type Artifact
- type BootConfig
- type CDRomConfig
- type ConfigParamsConfig
- type ConnectConfig
- type ContentLibraryDestinationConfig
- type DiskConfig
- type DownloadStep
- type ExportConfig
- type FlatCDRomConfig
- type FlatConfigParamsConfig
- type FlatConnectConfig
- type FlatContentLibraryDestinationConfig
- type FlatDiskConfig
- type FlatExportConfig
- type FlatFloppyConfig
- type FlatHardwareConfig
- type FlatLocationConfig
- type FlatOutputConfig
- type FlatRemoveCDRomConfig
- type FlatRunConfig
- type FlatShutdownConfig
- type FlatStorageConfig
- type FlatWaitIpConfig
- type FloppyConfig
- type HardwareConfig
- type LocationConfig
- type OutputConfig
- type RemoveCDRomConfig
- type RunConfig
- type ShutdownConfig
- type StepAddCDRom
- type StepAddFloppy
- type StepBootCommand
- type StepConfigParams
- type StepConfigureHardware
- type StepConnect
- type StepConvertToTemplate
- type StepCreateSnapshot
- type StepDownload
- type StepExport
- type StepHTTPIPDiscover
- type StepImportToContentLibrary
- type StepRemoteUpload
- type StepRemoveCDRom
- type StepRemoveFloppy
- type StepRun
- type StepShutdown
- type StepSshKeyPair
- type StepWaitForIp
- type StorageConfig
- type WaitIpConfig
Constants ¶
const BuilderId = "jetbrains.vsphere"
Variables ¶
This section is empty.
Functions ¶
func GetVMMetadata ¶ added in v1.0.2
Types ¶
type Artifact ¶
type Artifact struct {
Outconfig *OutputConfig
Name string
Location LocationConfig
Datacenter *object.Datacenter
VM *driver.VirtualMachineDriver
ContentLibraryConfig *ContentLibraryDestinationConfig
// StateData should store data such as GeneratedData
// to be shared with post-processors
StateData map[string]interface{}
}
type BootConfig ¶
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 ¶
func (c *BootConfig) Prepare(ctx *interpolate.Context) []error
type CDRomConfig ¶
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 ¶
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 ¶
func (c *CDRomConfig) Prepare() []error
type ConfigParamsConfig ¶
type ConfigParamsConfig struct {
// configuration_parameters is a direct passthrough to the vSphere API's
// ConfigSpec: https://vdc-download.vmware.com/vmwb-repository/dcr-public/bf660c0a-f060-46e8-a94d-4b5e6ffc77ad/208bc706-e281-49b6-a0ce-b402ec19ef82/SDK/vsphere-ws/docs/ReferenceGuide/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 the vCenter Server TLS certificate. Defaults to `false`.
InsecureConnection bool `mapstructure:"insecure_connection"`
// vSphere datacenter name. Required if there is more than one datacenter in the vSphere inventory.
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 ¶
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.
// 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"`
// When set to true, the VM won't be imported to the content library item. Useful for setting to `true` during a build test stage. Defaults to `false`.
SkipImport bool `mapstructure:"skip_import"`
// Flags to use for OVF package creation. The supported flags can be obtained using ExportFlag.list. If unset, no flags will be used. Known values: EXTRA_CONFIG, PRESERVE_MAC
OvfFlags []string `mapstructure:"ovf_flags"`
}
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 ¶
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 ¶
func (c *ContentLibraryDestinationConfig) Prepare(lc *LocationConfig) []error
type DiskConfig ¶
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 ¶
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 ¶
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 ¶
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"`
// Deprecated: Images will be removed in a future release. Please see `image_files` for more details on this argument.
Images bool `mapstructure:"images"`
// In exported files, include additional image files that are attached to the VM, such as nvram, iso, img.
ImageFiles bool `mapstructure:"image_files"`
// 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 ¶
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 ¶
func (c *ExportConfig) Prepare(ctx *interpolate.Context, lc *LocationConfig, pc *common.PackerConfig) []error
type FlatCDRomConfig ¶
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.
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.
type FlatContentLibraryDestinationConfig ¶
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"`
SkipImport *bool `mapstructure:"skip_import" cty:"skip_import" hcl:"skip_import"`
OvfFlags []string `mapstructure:"ovf_flags" cty:"ovf_flags" hcl:"ovf_flags"`
}
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 ¶
func (*FlatContentLibraryDestinationConfig) HCL2Spec() map[string]hcldec.Spec
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 ¶
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.
type FlatExportConfig ¶
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"`
ImageFiles *bool `mapstructure:"image_files" cty:"image_files" hcl:"image_files"`
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.
type FlatFloppyConfig ¶
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"`
FloppyContent map[string]string `mapstructure:"floppy_content" cty:"floppy_content" hcl:"floppy_content"`
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.
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"`
Displays *int32 `mapstructure:"displays" cty:"displays" hcl:"displays"`
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"`
VTPMEnabled *bool `mapstructure:"vTPM" cty:"vTPM" hcl:"vTPM"`
}
FlatHardwareConfig is an auto-generated flat version of HardwareConfig. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
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.
type FlatOutputConfig ¶
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.
type FlatRemoveCDRomConfig ¶
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 ¶
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.
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.
type FlatStorageConfig ¶
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.
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.
type FloppyConfig ¶
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"`
// Key/Values to add to the floppy disk. The keys represent the paths, and
// the values contents. It can be used alongside `floppy_files` or
// `floppy_dirs`, which is useful to add large files without loading them
// into memory. If any paths are specified by both, the contents in
// `floppy_content` will take precedence.
//
// Usage example (HCL):
//
// “`hcl
// floppy_content = {
// "meta-data" = jsonencode(local.instance_data)
// "user-data" = templatefile("user-data", { packages = ["nginx"] })
// }
// “`
FloppyContent map[string]string `mapstructure:"floppy_content"`
// 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 ¶
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. See [vSphere documentation](https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-789C3913-1053-4850-A0F0-E29C3D32B6DA.html)
// for supported maximums. Defaults to 4096 KB.
VideoRAM int64 `mapstructure:"video_ram"`
// Number of video displays. See [vSphere documentation](https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-789C3913-1053-4850-A0F0-E29C3D32B6DA.html)
// for supported maximums. Defaults to 1.
Displays int32 `mapstructure:"displays"`
// 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"`
// Add virtual TPM device for virtual machine. Defaults to `false`.
VTPMEnabled bool `mapstructure:"vTPM"`
}
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"`
// vSphere 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"`
// vSphere 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"`
// vSphere 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 ¶
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 ¶
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 ¶
func (c *OutputConfig) ListFiles() ([]string, error)
Stolen from output_dir_local.go in vmware builder.
func (*OutputConfig) Prepare ¶
func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error
type RemoveCDRomConfig ¶
type RemoveCDRomConfig struct {
// Remove CD-ROM devices from template. Defaults to `false`.
RemoveCdrom bool `mapstructure:"remove_cdrom"`
}
func (*RemoveCDRomConfig) FlatMapstructure ¶
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 ¶
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 Tools are used to gracefully shutdown
// the VM.
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 ¶
type StepAddCDRom struct {
Config *CDRomConfig
}
func (*StepAddCDRom) Cleanup ¶
func (s *StepAddCDRom) Cleanup(state multistep.StateBag)
func (*StepAddCDRom) Run ¶
func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepAddFloppy ¶
type StepAddFloppy struct {
Config *FloppyConfig
Datastore string
Host string
SetHostForDatastoreUploads bool
}
func (*StepAddFloppy) Cleanup ¶
func (s *StepAddFloppy) Cleanup(state multistep.StateBag)
func (*StepAddFloppy) Run ¶
func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepBootCommand ¶
type StepBootCommand struct {
Config *BootConfig
VMName string
Ctx interpolate.Context
}
func (*StepBootCommand) Cleanup ¶
func (s *StepBootCommand) Cleanup(_ multistep.StateBag)
func (*StepBootCommand) Run ¶
func (s *StepBootCommand) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepConfigParams ¶
type StepConfigParams struct {
Config *ConfigParamsConfig
}
func (*StepConfigParams) Cleanup ¶
func (s *StepConfigParams) Cleanup(state multistep.StateBag)
func (*StepConfigParams) Run ¶
func (s *StepConfigParams) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepConfigureHardware ¶
type StepConfigureHardware struct {
Config *HardwareConfig
}
func (*StepConfigureHardware) Cleanup ¶
func (s *StepConfigureHardware) Cleanup(multistep.StateBag)
func (*StepConfigureHardware) Run ¶
func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepConnect ¶
type StepConnect struct {
Config *ConnectConfig
}
func (*StepConnect) Cleanup ¶
func (s *StepConnect) Cleanup(state multistep.StateBag)
func (*StepConnect) Run ¶
func (s *StepConnect) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepConvertToTemplate ¶
type StepConvertToTemplate struct {
ConvertToTemplate bool
}
func (*StepConvertToTemplate) Cleanup ¶
func (s *StepConvertToTemplate) Cleanup(state multistep.StateBag)
func (*StepConvertToTemplate) Run ¶
func (s *StepConvertToTemplate) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepCreateSnapshot ¶
func (*StepCreateSnapshot) Cleanup ¶
func (s *StepCreateSnapshot) Cleanup(state multistep.StateBag)
func (*StepCreateSnapshot) Run ¶
func (s *StepCreateSnapshot) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepDownload ¶
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 ¶
func (s *StepDownload) Cleanup(state multistep.StateBag)
func (*StepDownload) Run ¶
func (s *StepDownload) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepExport ¶
type StepExport struct {
Name string
Force bool
ImageFiles bool
Manifest string
OutputDir string
Options []string
// contains filtered or unexported fields
}
func (*StepExport) Cleanup ¶
func (s *StepExport) Cleanup(multistep.StateBag)
func (*StepExport) Run ¶
func (s *StepExport) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepHTTPIPDiscover ¶
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 ¶
func (s *StepHTTPIPDiscover) Cleanup(state multistep.StateBag)
func (*StepHTTPIPDiscover) Run ¶
func (s *StepHTTPIPDiscover) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepImportToContentLibrary ¶
type StepImportToContentLibrary struct {
ContentLibConfig *ContentLibraryDestinationConfig
}
func (*StepImportToContentLibrary) Cleanup ¶
func (s *StepImportToContentLibrary) Cleanup(multistep.StateBag)
func (*StepImportToContentLibrary) Run ¶
func (s *StepImportToContentLibrary) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepRemoteUpload ¶
type StepRemoteUpload struct {
Datastore string
Host string
SetHostForDatastoreUploads bool
UploadedCustomCD bool
}
func (*StepRemoteUpload) Cleanup ¶
func (s *StepRemoteUpload) Cleanup(state multistep.StateBag)
func (*StepRemoteUpload) Run ¶
func (s *StepRemoteUpload) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepRemoveCDRom ¶
type StepRemoveCDRom struct {
Config *RemoveCDRomConfig
}
func (*StepRemoveCDRom) Cleanup ¶
func (s *StepRemoveCDRom) Cleanup(state multistep.StateBag)
func (*StepRemoveCDRom) Run ¶
func (s *StepRemoveCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepRemoveFloppy ¶
func (*StepRemoveFloppy) Cleanup ¶
func (s *StepRemoveFloppy) Cleanup(state multistep.StateBag)
func (*StepRemoveFloppy) Run ¶
func (s *StepRemoveFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction
type StepShutdown ¶
type StepShutdown struct {
Config *ShutdownConfig
}
func (*StepShutdown) Cleanup ¶
func (s *StepShutdown) Cleanup(state multistep.StateBag)
func (*StepShutdown) Run ¶
func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepSshKeyPair ¶
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 ¶
func (s *StepSshKeyPair) Cleanup(state multistep.StateBag)
func (*StepSshKeyPair) Run ¶
func (s *StepSshKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepWaitForIp ¶
type StepWaitForIp struct {
Config *WaitIpConfig
}
func (*StepWaitForIp) Cleanup ¶
func (s *StepWaitForIp) Cleanup(state multistep.StateBag)
func (*StepWaitForIp) Run ¶
func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StorageConfig ¶
type StorageConfig struct {
// Set VM disk controller type. Example `lsilogic`, `lsilogic-sas`, `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 ¶
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 ¶
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 ¶
func (c *WaitIpConfig) GetIPNet() *net.IPNet
func (*WaitIpConfig) Prepare ¶
func (c *WaitIpConfig) Prepare() []error
Source Files
¶
- artifact.go
- cleanup_vm.go
- config_location.go
- config_location.hcl2spec.go
- config_ssh.go
- hcp_metadata.go
- output_config.go
- output_config.hcl2spec.go
- step_add_cdrom.go
- step_add_cdrom.hcl2spec.go
- step_add_floppy.go
- step_add_floppy.hcl2spec.go
- step_boot_command.go
- step_config_params.go
- step_config_params.hcl2spec.go
- step_connect.go
- step_connect.hcl2spec.go
- step_download.go
- step_export.go
- step_export.hcl2spec.go
- step_hardware.go
- step_hardware.hcl2spec.go
- step_http_ip_discover.go
- step_import_to_content_library.go
- step_import_to_content_library.hcl2spec.go
- step_remote_upload.go
- step_remove_cdrom.go
- step_remove_cdrom.hcl2spec.go
- step_remove_floppy.go
- step_run.go
- step_run.hcl2spec.go
- step_shutdown.go
- step_shutdown.hcl2spec.go
- step_snapshot.go
- step_ssh_key_pair.go
- step_template.go
- step_wait_for_ip.go
- step_wait_for_ip.hcl2spec.go
- storage_config.go
- storage_config.hcl2spec.go