Skip to content

Commit e53e401

Browse files
tenthirtyamlbajolet-hashicorp
authored andcommitted
docs: update vsphere-clone
Update the docs for the `step_clone` and `step_customize` to be a little less jarring and comment formatting. Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
1 parent ac740b1 commit e53e401

16 files changed

Lines changed: 354 additions & 231 deletions

.web-docs/components/builder/vsphere-clone/README.md

Lines changed: 118 additions & 77 deletions
Large diffs are not rendered by default.

builder/vsphere/clone/config.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,29 @@ type Config struct {
3838
Comm communicator.Config `mapstructure:",squash"`
3939
common.ShutdownConfig `mapstructure:",squash"`
4040

41-
// Specifies to create a snapshot of the virtual machine to use as a base for linked clones.
42-
// Defaults to `false`.
41+
// Create a snapshot of the virtual machine to use as a base for linked
42+
// clones. Defaults to `false`.
4343
CreateSnapshot bool `mapstructure:"create_snapshot"`
44-
// Specifies the name of the snapshot when `create_snapshot` is `true`.
44+
// The name of the snapshot when `create_snapshot` is `true`.
4545
// Defaults to `Created By Packer`.
4646
SnapshotName string `mapstructure:"snapshot_name"`
47-
// Specifies to convert the cloned virtual machine to a template after the build is complete.
48-
// Defaults to `false`.
49-
// If set to `true`, the virtual machine can not be imported to a content library.
47+
// Convert the cloned virtual machine to a template after the build is
48+
// complete. Defaults to `false`.
49+
// If set to `true`, the virtual machine can not be imported to a content
50+
// library.
5051
ConvertToTemplate bool `mapstructure:"convert_to_template"`
51-
// Specifies the configuration for exporting the virtual machine to an OVF.
52-
// The virtual machine is not exported if [export configuration](#export-configuration) is not specified.
52+
// The configuration for exporting the virtual machine to an OVF.
53+
// The virtual machine is not exported if [export configuration](#export-configuration)
54+
// is not specified.
5355
Export *common.ExportConfig `mapstructure:"export"`
54-
// Specifies the configuration for importing a VM template or OVF template to a content library.
55-
// The template will not be imported if no [content library import configuration](#content-library-import-configuration) is specified.
56-
// If set, `convert_to_template` must be set to `false`.
56+
// The configuration for importing a VM template or OVF template to a
57+
// content library. The template will not be imported if no
58+
// [content library import configuration](#content-library-import-configuration)
59+
// is specified. If set, `convert_to_template` must be set to `false`.
5760
ContentLibraryDestinationConfig *common.ContentLibraryDestinationConfig `mapstructure:"content_library_destination"`
58-
// Specifies the customization options for the virtual machine.
59-
// Refer to the [customization options](#customization) section for more information.
61+
// The customization options for the virtual machine.
62+
// Refer to the [customization options](#customization) section for more
63+
// information.
6064
CustomizeConfig *CustomizeConfig `mapstructure:"customize"`
6165

6266
ctx interpolate.Context

builder/vsphere/clone/step_clone.go

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,31 @@ import (
2020
)
2121

2222
type vAppConfig struct {
23-
// Specifies the values for the available vApp properties. These are used to supply
24-
// configuration parameters to a virtual machine. This machine is cloned from a template
25-
// that originated from an imported OVF or OVA file.
23+
// The values for the available vApp properties. These are used to supply
24+
// configuration parameters to a virtual machine. This machine is cloned
25+
// from a template that originated from an imported OVF or OVA file.
2626
//
27-
// -> **Note:** The only supported usage path for vApp properties is for existing
28-
// user-configurable keys. These generally come from an existing template that was
29-
// created from an imported OVF or OVA file.
27+
// -> **Note:** The only supported usage path for vApp properties is for
28+
// existing user-configurable keys. These generally come from an existing
29+
// template that was created from an imported OVF or OVA file.
3030
//
31-
// You cannot set values for vApp properties on virtual machines created from scratch,
32-
// on virtual machines that lack a vApp configuration, or on property keys that do not exist.
31+
// You cannot set values for vApp properties on virtual machines created
32+
// from scratch, on virtual machines that lack a vApp configuration, or on
33+
// property keys that do not exist.
3334
Properties map[string]string `mapstructure:"properties"`
3435
}
3536

3637
type CloneConfig struct {
37-
// Specifies the name of the source virtual machine to clone.
38+
// The name of the source virtual machine to clone.
3839
Template string `mapstructure:"template"`
39-
// Specifies the size of the primary disk in MiB.
40-
// Cannot be used with `linked_clone`.
41-
// -> **Note:** Only the primary disk size can be specified. Additional disks are not supported.
40+
// The size of the primary disk in MiB. Cannot be used with `linked_clone`.
41+
// -> **Note:** Only the primary disk size can be specified. Additional
42+
// disks are not supported.
4243
DiskSize int64 `mapstructure:"disk_size"`
43-
// Specifies that the virtual machine is created as a linked clone from the latest snapshot. Defaults to `false`.
44-
// Cannot be used with `disk_size`.`
44+
// Create the virtual machine as a linked clone from the latest snapshot.
45+
// Defaults to `false`. Cannot be used with `disk_size`.`
4546
LinkedClone bool `mapstructure:"linked_clone"`
46-
// Specifies the network to which the virtual machine will connect.
47+
// The network to which the virtual machine will connect.
4748
//
4849
// For example:
4950
//
@@ -54,21 +55,22 @@ type CloneConfig struct {
5455
// - Logical Switch UUID: `<uuid>`
5556
// - Segment ID: `/infra/segments/<SegmentID>`
5657
//
57-
// ~> **Note:** If more than one network resolves to the same name, either the inventory path to
58-
// network or an ID must be provided.
58+
// ~> **Note:** If more than one network resolves to the same name, either
59+
// the inventory path to network or an ID must be provided.
5960
//
60-
// ~> **Note:** If no network is specified, provide `host` to allow the plugin to search for an
61-
// available network.
61+
// ~> **Note:** If no network is specified, provide `host` to allow the
62+
// plugin to search for an available network.
6263
Network string `mapstructure:"network"`
63-
// Specifies the network card MAC address. For example `00:50:56:00:00:00`.
64+
// The network card MAC address. For example `00:50:56:00:00:00`.
6465
// If set, the `network` must be also specified.
6566
MacAddress string `mapstructure:"mac_address"`
66-
// Specifies the annotations for the virtual machine.
67+
// The annotations for the virtual machine.
6768
Notes string `mapstructure:"notes"`
68-
// Specifies whether to destroy the virtual machine after the build is complete.
69+
// Destroy the virtual machine after the build is complete.
70+
// Defaults to `false`.
6971
Destroy bool `mapstructure:"destroy"`
70-
// Specifies the vApp Options for the virtual machine. For more information, refer to the
71-
// [vApp Options Configuration](/packer/plugins/builders/vmware/vsphere-clone#vapp-options-configuration)
72+
// The vApp Options for the virtual machine. For more information, refer to
73+
// the [vApp Options Configuration](/packer/plugins/builders/vmware/vsphere-clone#vapp-options-configuration)
7274
// section.
7375
VAppConfig vAppConfig `mapstructure:"vapp"`
7476
StorageConfig common.StorageConfig `mapstructure:",squash"`

builder/vsphere/clone/step_customize.go

Lines changed: 75 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,30 @@ var (
2626
// A cloned virtual machine can be [customized](https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vm-administration/GUID-58E346FF-83AE-42B8-BE58-253641D257BC.html)
2727
// to configure host, network, or licensing settings.
2828
//
29-
// To perform virtual machine customization as a part of the clone process, specify the customize block with the
30-
// respective customization options. Windows guests are customized using Sysprep, which will result in the machine SID being reset.
31-
// Before using customization, check that your source virtual machine meets the
32-
// [requirements](https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vm-administration/GUID-E63B6FAA-8D35-428D-B40C-744769845906.html)
29+
// To perform virtual machine customization as a part of the clone process,
30+
// specify the customize block with the respective customization options.
31+
// Windows guests are customized using Sysprep, which will result in the machine
32+
// SID being reset. Before using customization, check that your source virtual
33+
// machine meets the [requirements](https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vm-administration/GUID-E63B6FAA-8D35-428D-B40C-744769845906.html)
3334
// for guest OS customization on vSphere. Refer to the [customization example](#customization-example) for a usage synopsis.
3435
//
3536
// The settings for guest customization include:
3637
type CustomizeConfig struct {
37-
// Settings for the guest customization of Linux operating systems. Refer to the [Linux options](#linux-options) section for additional details.
38+
// Settings for the guest customization of Linux operating systems.
39+
// Refer to the [Linux options](#linux-options) section for additional
40+
// details.
3841
LinuxOptions *LinuxOptions `mapstructure:"linux_options"`
39-
// Settings for the guest customization of Windows operating systems. Refer to the [Windows options](#windows-options) section for additional details.
42+
// Settings for the guest customization of Windows operating systems.
43+
// Refer to the [Windows options](#windows-options) section for additional
44+
// details.
4045
WindowsOptions *WindowsOptions `mapstructure:"windows_options"`
41-
// Provide a `sysprep.xml` file to allow control of the customization process independent of vSphere. This option is deprecated, please use `windows_sysprep_text`.
46+
// Provide a `sysprep.xml` file to allow control of the customization
47+
// process independent of vSphere. This option is deprecated, please use
48+
// `windows_sysprep_text`.
4249
WindowsSysPrepFile string `mapstructure:"windows_sysprep_file"`
43-
// Provide the text for the `sysprep.xml` content to allow control of the customization process independent of vSphere. This option is intended to be used with HCL templates.
50+
// Provide the text for the `sysprep.xml` content to allow control of the
51+
// customization process independent of vSphere. This option is intended to
52+
// be used with HCL templates.
4453
//
4554
// Example usage:
4655
//
@@ -61,81 +70,107 @@ type CustomizeConfig struct {
6170
// }
6271
// ```
6372
WindowsSysPrepText string `mapstructure:"windows_sysprep_text"`
64-
// Set up network interfaces individually to correspond with the network adapters on the virtual machine.
65-
// To use DHCP, specify an empty `network_interface` for each configured adapter. This field is mandatory.
66-
// Refer to the [network interface](#network-interface-settings) section for additional details.
73+
// Set up network interfaces individually to correspond with the network
74+
// adapters on the virtual machine. To use DHCP, specify an empty
75+
// `network_interface` for each configured adapter. This field is mandatory.
76+
// Refer to the [network interface](#network-interface-settings) section for
77+
// additional details.
6778
NetworkInterfaces NetworkInterfaces `mapstructure:"network_interface"`
6879
GlobalRoutingSettings `mapstructure:",squash"`
6980
GlobalDnsSettings `mapstructure:",squash"`
7081
}
7182

7283
type LinuxOptions struct {
73-
// Specifies the domain name for the guest operating system. Used with [host_name](#host_name) to construct the fully qualified domain name (FQDN).
84+
// The domain name for the guest operating system. Used with
85+
// [host_name](#host_name) to construct the fully qualified domain name
86+
// (FQDN).
7487
Domain string `mapstructure:"domain"`
75-
// Specifies the hostname for the guest operating system. Used with [domain](#domain) to construct the fully qualified domain name (FQDN).
88+
// The hostname for the guest operating system. Used with [domain](#domain)
89+
// to construct the fully qualified domain name (FQDN).
7690
Hostname string `mapstructure:"host_name"`
77-
// Specifies whether the hardware clock is set to Coordinated Universal Time (UTC). Defaults to `true`.
91+
// Set the hardware clock to Coordinated Universal Time (UTC).
92+
// Defaults to `true`.
7893
HWClockUTC config.Trilean `mapstructure:"hw_clock_utc"`
79-
// Specifies the time zone for the guest operating system.
94+
// The time zone for the guest operating system.
8095
Timezone string `mapstructure:"time_zone"`
8196
}
8297

8398
type WindowsOptions struct {
84-
// Specifies a list of commands to run at first logon after the guest operating system is customized.
99+
// A list of commands to run at first logon after the guest operating system
100+
// is customized.
85101
RunOnceCommandList []string `mapstructure:"run_once_command_list"`
86-
// Specifies whether the guest operating system automatically logs on as Administrator.
102+
// Aautomatically log on the Administrator account after the guest operating
103+
// system is customized.
87104
AutoLogon *bool `mapstructure:"auto_logon"`
88-
// Specifies how many times the guest operating system should auto-logon the Administrator account when `auto_logon` is set to `true`. Default:s to `1`.
105+
// The number of times the guest operating system should auto-logon the
106+
// Administrator account when `auto_logon` is set to `true`.
107+
// Defaults to `1`.
89108
AutoLogonCount *int32 `mapstructure:"auto_logon_count"`
90-
// Specifies the password for the guest operating system's Administrator account.
109+
// The password for the guest operating system's `Administrator`` account.
91110
AdminPassword *string `mapstructure:"admin_password"`
92-
// Specifies the time zone for the guest operating system. Default to `85` (Pacific Time).
111+
// The time zone for the guest operating system.
112+
// Defaults to `85` (Pacific Time).
93113
TimeZone *int32 `mapstructure:"time_zone"`
94-
// Specifies the workgroup for the guest operating system. Joining an Active Directory domain is not supported.
114+
// The workgroup for the guest operating system.
115+
// Joining an Active Directory domain is not supported.
95116
Workgroup string `mapstructure:"workgroup"`
96-
// Specifies the hostname for the guest operating system.
117+
// The hostname for the guest operating system.
97118
ComputerName string `mapstructure:"computer_name"`
98-
// Specifies the full name for the guest operating system's Administrator account. Defaults to `Administrator`.
119+
// The full name for the guest operating system's Administrator account.
120+
// Defaults to `Administrator`.
99121
FullName string `mapstructure:"full_name"`
100-
// Specifies the organization name for the guest operating system. Defaults to `Built by Packer`.
122+
// The organization name for the guest operating system.
123+
// Defaults to `Built by Packer`.
101124
OrganizationName string `mapstructure:"organization_name"`
102-
// Specifies the product key for the guest operating system.
125+
// The product key for the guest operating system.
103126
ProductKey string `mapstructure:"product_key"`
104127
}
105128

106129
type NetworkInterface struct {
107-
// Specifies the DNS servers for a specific network interface on a Windows guest operating system.
108-
// Ignored on Linux. Refer to the [global DNS settings](#global-dns-settings) section for additional details.
130+
// The DNS servers for a specific network interface on a Windows guest
131+
// operating system. Ignored on Linux. Refer to the
132+
// [global DNS settings](#global-dns-settings) section for additional
133+
// details.
109134
DnsServerList []string `mapstructure:"dns_server_list"`
110-
// Specifies the DNS search domain for a specific network interface on a Windows guest operating system.
111-
// Ignored on Linux. Refer to the [global DNS settings](#global-dns-settings) section for additional details.
135+
// The DNS search domain for a specific network interface on a Windows guest
136+
// operating system. Ignored on Linux. Refer to the
137+
// [global DNS settings](#global-dns-settings) section for additional
138+
// details.
112139
DnsDomain string `mapstructure:"dns_domain"`
113-
// Specifies the IPv4 address assigned to the network adapter. If left blank or not included, DHCP is used.
140+
// The IPv4 address assigned to the network adapter. If left blank or not
141+
// included, DHCP is used.
114142
Ipv4Address string `mapstructure:"ipv4_address"`
115-
// Specifies the IPv4 subnet mask, in bits, for the network adapter. For example, `24` for a `/24` subnet.
143+
// The IPv4 subnet mask, in bits, for the network adapter. For example, `24`
144+
// for a `/24` subnet.
116145
Ipv4NetMask int `mapstructure:"ipv4_netmask"`
117-
// Specifies the IPv6 address assigned to the network adapter. If left blank or not included, auto-configuration is used.
146+
// The IPv6 address assigned to the network adapter. If left blank or not
147+
// included, auto-configuration is used.
118148
Ipv6Address string `mapstructure:"ipv6_address"`
119-
// Specifies the IPv6 subnet mask, in bits, for the network adapter. For example, `64` for a `/64` subnet.
149+
// The IPv6 subnet mask, in bits, for the network adapter. For example, `64`
150+
// for a `/64` subnet.
120151
Ipv6NetMask int `mapstructure:"ipv6_netmask"`
121152
}
122153

123154
type NetworkInterfaces []NetworkInterface
124155

125-
// The settings must match the IP address and subnet mask of at least one `network_interface` for the customization.
156+
// The settings must match the IP address and subnet mask of at least one
157+
// `network_interface` for the customization.
126158
type GlobalRoutingSettings struct {
127-
// Specifies the IPv4 default gateway when using `network_interface` customization.
159+
// The IPv4 default gateway when using `network_interface` customization.
128160
Ipv4Gateway string `mapstructure:"ipv4_gateway"`
129-
// Specifies the IPv6 default gateway when using `network_interface` customization.
161+
// The IPv6 default gateway when using `network_interface` customization.
130162
Ipv6Gateway string `mapstructure:"ipv6_gateway"`
131163
}
132164

133-
// The following settings configure DNS globally for Linux guest operating systems.
134-
// For Windows guest operating systems, this is set for each network interface. Refer to the [network interface](#network_interface) section for additional details.
165+
// The following settings configure DNS globally for Linux guest operating
166+
// systems. For Windows guest operating systems, this is set for each network
167+
// interface. Refer to the [network interface](#network_interface) section for
168+
// additional details.
135169
type GlobalDnsSettings struct {
136-
// Specifies a list of DNS servers to configure on the guest operating system.
170+
// A list of DNS servers to configure on the guest operating system.
137171
DnsServerList []string `mapstructure:"dns_server_list"`
138-
// Specifies a list of DNS search domains to add to the DNS configuration on the guest operating system.
172+
// A list of DNS search domains to add to the DNS configuration on the guest
173+
// operating system.
139174
DnsSuffixList []string `mapstructure:"dns_suffix_list"`
140175
}
141176

0 commit comments

Comments
 (0)