Skip to content

Commit

Permalink
docs: technical debt
Browse files Browse the repository at this point in the history
- General cleanup of the documentation.
- Standardize heading for Required and Optional.
- Standardize headings for HCL and JSON.
- Standardize leading with HCL examples.
- Format for cleanliness.

Signed-off-by: Ryan Johnson <[email protected]>
  • Loading branch information
tenthirtyam committed May 16, 2024
1 parent f5faf82 commit fd96970
Show file tree
Hide file tree
Showing 58 changed files with 3,046 additions and 2,526 deletions.
929 changes: 530 additions & 399 deletions .web-docs/components/builder/vsphere-clone/README.md

Large diffs are not rendered by default.

1,992 changes: 1,019 additions & 973 deletions .web-docs/components/builder/vsphere-iso/README.md

Large diffs are not rendered by default.

95 changes: 54 additions & 41 deletions .web-docs/components/builder/vsphere-supervisor/README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,68 @@
Type: `vsphere-supervisor`

Artifact BuilderId: `vsphere.supervisor`

This builder deploys and publishes new VMs to a vSphere Supervisor cluster using VM Service.
If you are new to VM Service, please refer to [Deploying and Managing Virtual Machines in vSphere with Tanzu
](https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-with-tanzu-services-workloads/GUID-F81E3535-C275-4DDE-B35F-CE759EA3B4A0.html) for more information.
This builder creates a virtual machine on a vSphere Supervisor cluster using the VM-Operator API.

Refer to [Deploying and Managing Virtual Machines in vSphere with Tanzu](https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-with-tanzu-services-workloads/GUID-F81E3535-C275-4DDE-B35F-CE759EA3B4A0.html)
for more information on the VM Service functionality in vSphere with Tanzu.

- It uses a `kubeconfig` file to connect to the vSphere Supervisor cluster.
- It uses the [VM-Operator API](https://vm-operator.readthedocs.io/en/latest/concepts/) to deploy
and configure the source virtual machine.
- It cna use Packer provisioners to customize the virtual machine after establishing a successful
connection.
- It publishes the customized virtual machine as a new virtual machine image to the designated
content library in vSphere.

- It uses a kubeconfig file to connect to the vSphere Supervisor cluster.
- It uses the [VM-Operator API](https://vm-operator.readthedocs.io/en/latest/concepts/) to deploy and configure the source VM.
- It uses the Packer provisioners to customize the VM after establishing a successful connection.
- It publishes the customized VM as a new VM image to the designated content library in vSphere.
- The builder supports versions following the VMware Product Lifecycle Matrix
from General Availability to End of General Support. Builds on versions that
are end of support may work, but configuration options may throw errors if
they do not exist in the vSphere API for those versions.
-> **Note:** This builder is developed to maintain compatibility with VMware vSphere versions until
their respective End of General Support dates. For detailed information, refer to the
[Broadcom Product Lifecycle](https://support.broadcom.com/group/ecx/productlifecycle).

## Examples

Example Packer template:
Examples are available in the [examples](https://github.com/hashicorp/packer-plugin-vsphere/tree/main/builder/vsphere/examples/)
directory of the GitHub repository.

**HCL2**
HCL Example:

```hcl
source "vsphere-supervisor" "example-vm" {
image_name = "<Image name of the source VM, e.g. 'ubuntu-impish-21.10-cloudimg'>"
class_name = "<VM class that describes the virtual hardware settings, e.g. 'best-effort-large'>"
storage_class = "<Storage class that provides the backing storage for volume, e.g. 'wcplocal-storage-profile'>"
bootstrap_provider = "<CloudInit, Sysprep, or vAppConfig to customize the guest OS>"
bootstrap_data_file = "<Path to the file containing the bootstrap data for guest OS customization>"
image_name = "<image name of the source virtual machine, e.g. 'ubuntu-24.04-server-cloudimg'>"
class_name = "<virtual machine class that describes the virtual hardware settings, e.g. 'best-effort-large'>"
storage_class = "<storage class that provides the backing storage for volume, e.g. 'wcplocal-storage-profile'>"
bootstrap_provider = "<cloud-init, sysprep, or vAppConfig to customize the guest os>"
bootstrap_data_file = "<path to the file containing the bootstrap data for guest os customization>"
}
build {
sources = ["source.vsphere-supervisor.example-vm"]
}
```

**JSON**
JSON Example:

```json
{
"builders": [
{
"type": "vsphere-supervisor",
"image_name": "<Image name of the source VM, e.g. 'ubuntu-impish-21.10-cloudimg'>",
"class_name": "<VM class that describes the virtual hardware settings, e.g. 'best-effort-large'>",
"storage_class": "<Storage class that provides the backing storage for volume, e.g. 'wcplocal-storage-profile'>",
"bootstrap_provider": "<CloudInit, Sysprep, or vAppConfig to customize the guest OS>",
"bootstrap_data_file": "<Path to the file containing the bootstrap data for guest OS customization>"
"image_name": "<image name of the source virtual machine, e.g. 'ubuntu-24.04-server-cloudimg'>",
"class_name": "<virtual machine class that describes the virtual hardware settings, e.g. 'best-effort-large'>",
"storage_class": "<storage class that provides the backing storage for volume, e.g. 'wcplocal-storage-profile'>",
"bootstrap_provider": "<cloud-init, sysprep, or vAppConfig to customize the guest os>",
"bootstrap_data_file": "<path to the file containing the bootstrap data for guest os customization>"
}
]
}
```


Refer to the [examples/supervisor directory](https://github.com/hashicorp/packer-plugin-vsphere/tree/main/builder/vsphere/examples/supervisor) within the GitHub repository for more complete examples.

## Configuration Reference
There are various configuration options available for each step in this builder. The _required_ items are listed below as well as the _optional_ configs further down the page.

### Required
There are various configuration options available for each step in this builder. The _required_
items are listed below as well as the _optional_ configurations.

**Required**:

<!-- Code generated from the comments of the CreateSourceConfig struct in builder/vsphere/supervisor/step_create_source.go; DO NOT EDIT MANUALLY -->

Expand All @@ -70,9 +75,9 @@ There are various configuration options available for each step in this builder.
<!-- End of code generated from the comments of the CreateSourceConfig struct in builder/vsphere/supervisor/step_create_source.go; -->


### Optional
### Supervisor Connection

#### Supervisor Connection
**Optional**:

<!-- Code generated from the comments of the ConnectSupervisorConfig struct in builder/vsphere/supervisor/step_connect_supervisor.go; DO NOT EDIT MANUALLY -->

Expand All @@ -83,7 +88,9 @@ There are various configuration options available for each step in this builder.
<!-- End of code generated from the comments of the ConnectSupervisorConfig struct in builder/vsphere/supervisor/step_connect_supervisor.go; -->


#### Source VM Creation
### Source Virtual Machine Creation

**Optional**:

<!-- Code generated from the comments of the CreateSourceConfig struct in builder/vsphere/supervisor/step_create_source.go; DO NOT EDIT MANUALLY -->

Expand All @@ -104,7 +111,9 @@ There are various configuration options available for each step in this builder.
<!-- End of code generated from the comments of the CreateSourceConfig struct in builder/vsphere/supervisor/step_create_source.go; -->


#### Source VM Watching
### Source Virtual Machine Watching

**Optional**:

<!-- Code generated from the comments of the WatchSourceConfig struct in builder/vsphere/supervisor/step_watch_source.go; DO NOT EDIT MANUALLY -->

Expand All @@ -113,7 +122,9 @@ There are various configuration options available for each step in this builder.
<!-- End of code generated from the comments of the WatchSourceConfig struct in builder/vsphere/supervisor/step_watch_source.go; -->


#### Source VM Publishing
### Source Virtual Machine Publishing

**Optional**:

<!-- Code generated from the comments of the PublishSourceConfig struct in builder/vsphere/supervisor/step_publish_source.go; DO NOT EDIT MANUALLY -->

Expand All @@ -124,7 +135,9 @@ There are various configuration options available for each step in this builder.
<!-- End of code generated from the comments of the PublishSourceConfig struct in builder/vsphere/supervisor/step_publish_source.go; -->


#### Communicator Configuration
### Communicator Configuration

**Optional**:

<!-- Code generated from the comments of the SSH struct in communicator/config.go; DO NOT EDIT MANUALLY -->

Expand Down Expand Up @@ -294,10 +307,11 @@ There are various configuration options available for each step in this builder.

## Deprovisioning Tasks

If you would like to clean up the VM after the build is complete, you could use the Ansible
provisioner to run the following tasks to delete machine-specific files and data.
If you would like to clean up the virtual machine after the build is complete, you can use the
[Ansible provisioner](https://developer.hashicorp.com/packer/integrations/hashicorp/ansible/latest/components/provisioner/ansible)
to run the following tasks to delete machine-specific files and data.

**HCL2**
HCL Example:

```hcl
build {
Expand All @@ -309,7 +323,7 @@ build {
}
```

**JSON**
JSON Example:

```json
{
Expand All @@ -327,13 +341,12 @@ build {
}
```


Content of `cleanup-playbook.yml`:

```yaml
---
# cleanup-playbook.yml
- name: Clean up source VM
- name: Clean up source virtual machine
hosts: default
become: true
tasks:
Expand Down
49 changes: 28 additions & 21 deletions .web-docs/components/post-processor/vsphere-template/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,53 @@
Type: `vsphere-template`

Artifact BuilderId: `packer.post-processor.vsphere`

This post-processor uses an artifact from the `vmware-iso` builder with an ESXi host or an artifact
from the [vSphere](/packer/integrations/hashicorp/vsphere/latest/components/post-processor/vsphere) post-processor. It then marks
the virtual machine as a template and moves it to your specified path.

## Configuration
-> **Note:** This post-processor is developed to maintain compatibility with VMware vSphere versions until
their respective End of General Support dates. For detailed information, refer to the
[Broadcom Product Lifecycle](https://support.broadcom.com/group/ecx/productlifecycle).

## Configuration Reference

The following configuration options are available for the post-processor.

Required:
**Required:**

<!-- Code generated from the comments of the Config struct in post-processor/vsphere-template/post-processor.go; DO NOT EDIT MANUALLY -->

- `host` (string) - Specifies the fully qualified domain name or IP address of the vSphere endpoint.
- `host` (string) - The fully qualified domain name or IP address of the vSphere endpoint.

- `username` (string) - Specifies the username to use to authenticate to the vSphere endpoint.
- `username` (string) - The username to use to authenticate to the vSphere endpoint.

- `password` (string) - Specifies the password to use to authenticate to the vSphere endpoint.
- `password` (string) - The password to use to authenticate to the vSphere endpoint.

<!-- End of code generated from the comments of the Config struct in post-processor/vsphere-template/post-processor.go; -->


Optional:
**Optional:**

<!-- Code generated from the comments of the Config struct in post-processor/vsphere-template/post-processor.go; DO NOT EDIT MANUALLY -->

- `insecure` (bool) - Specifies whether to skip the verification of the server certificate. Defaults to `false`.
- `insecure` (bool) - Skip the verification of the server certificate. Defaults to `false`.

- `datacenter` (string) - Specifies the name of the datacenter to use.
- `datacenter` (string) - The name of the datacenter to use.
Required when the vCenter Server instance endpoint has more than one datacenter.

- `template_name` (string) - Specifies the name of the template.
- `template_name` (string) - The name of the template.
If not specified, the name of the virtual machine will be used.

- `folder` (string) - Specifies the name of the virtual machine folder path where the template will be created.
- `folder` (string) - The name of the virtual machine folder path where the template will be created.

- `snapshot_enable` (bool) - Specifies whether to create a snapshot before marking as a template. Defaults to `false`.
- `snapshot_enable` (bool) - Create a snapshot before marking as a template. Defaults to `false`.

- `snapshot_name` (string) - Specifies the name of the snapshot. Required when `snapshot_enable` is `true`.
- `snapshot_name` (string) - The name of the snapshot. Required when `snapshot_enable` is `true`.

- `snapshot_description` (string) - Specifies a description for the snapshot. Required when `snapshot_enable` is `true`.
- `snapshot_description` (string) - A description for the snapshot. Required when `snapshot_enable` is `true`.

- `reregister_vm` (boolean) - Specifies to keep the virtual machine registered after marking as a template.
- `reregister_vm` (boolean) - Keepe the virtual machine registered after marking as a template.

<!-- End of code generated from the comments of the Config struct in post-processor/vsphere-template/post-processor.go; -->

Expand All @@ -58,7 +63,7 @@ Optional:

An example is shown below, showing only the post-processor configuration:

In HCL2:
HCL Example:

```hcl
source "null" "example" {
Expand All @@ -83,7 +88,7 @@ build {
}
```

In JSON:
JSON Example:

```json
{
Expand Down Expand Up @@ -115,7 +120,7 @@ Once the [vSphere](/packer/integrations/hashicorp/vsphere/latest/components/post
from the builder and uploads it to a vSphere endpoint, you may want the virtual machine to be marked
as a template.

In HCL2:
HCL Example:

```hcl
build {
Expand All @@ -135,7 +140,7 @@ build {
}
```

In JSON:
JSON Example:

```json
{
Expand Down Expand Up @@ -167,10 +172,12 @@ In JSON:
In the example above, the result of each builder is passed through the defined sequence of
post-processors starting with the `vsphere` post-processor which will upload the artifact to a
vSphere endpoint. The resulting artifact is then passed on to the `vsphere-template` post-processor
which handles marking a VM as a template. In JSON, note that the `vsphere` and `vsphere-template`
post-processors can be paired together in their own array.
which handles marking a virtual machine as a template.

In JSON, note that the `vsphere` and `vsphere-template` post-processors can be paired together in
their own array.

## Permissions
## Privileges

The post processor needs several privileges to be able to mark the virtual as a template.

Expand Down

0 comments on commit fd96970

Please sign in to comment.