Multiple VM Notes using VCF Automation

We've discussed VM Notes using VCF Automation previously here, but I wanted a bit more than this. Specifically, I wanted multiple lines in my VM Notes tile, something like this.

One way to do this is basically the same way we did it previously, but this requires the user enter the notes in a key:value pair format, like this. FYI, all screenshots here are taken from VCFA 8.18.8, but this would work for VCFA 9.x VM Apps too.

I've skinned the Blueprint with a Custom Form in this case using Text Area Display Type for the VM Notes field.

I've also provided guidance for the user via Custom Help, instructing the user what to enter into the Text Area box. Ultimately, this will add whatever the user enters here, so there is potential for human error. A VM deployment using this methodology looks like this.

If you recall from the original blog, we're using a Subscription in this case (triggered by the Compute post provision event), that runs a vRO Workflows to do the work.

If you want this vRO Packages you can get it here.
Another way to do this would be to ask the user for input for each field you want in the Notes Tile. For this we need a new Blueprint, Custom Form (optional), Subscription, and vRO Workflow (to process the input and place it where it needs to go). Here's what I came up with, my Blueprint looks like this.
# Created by Brock Peterson.
formatVersion: 1
inputs:
vm_display_name:
type: string
description: VM Display Name
title: VM Display Name
vm_dns_name:
type: string
description: VM DNS Name
title: VM DNS Name
vcpuCount:
type: integer
description: Number of vCPUs
title: vCPU being requested
default: 2
minimum: 2
maximum: 32
totalMemoryMB:
type: integer
description: Memory in MB
title: Memory being requested (MB)
default: 4096
minimum: 4096
maximum: 32768
enum:
- 4096
- 8192
- 12288
- 16384
- 20480
- 24576
- 28672
- 32768
os:
type: string
description: OS
title: OS for VM
default: Windows 2022
enum:
- CentOS Linux 7
- CentOS Linux 8
- Debian Linux 12
- Oracle Linux 9
- RHEL 7
- Rocky Linux 9
- Windows 2022
- Windows
network:
type: string
description: Network
title: Network
default: VM Network
enum:
- VM Network
- vcf-ops-ds1-DVUplinks-30
- vcf-ops
vm_snapshot:
type: string
description: Snapshot after deployment?
title: Snapshot after deployment?
enum:
- 'YES'
- 'NO'
owner:
type: string
description: VM Owner (email address)
title: VM Owner (email address)
description:
type: string
description: VM Description
title: VM Description
category:
type: string
description: VM Category
title: VM Category
default: TEST
enum:
- TEST
- DEVELOPMENT
- PRODUCTION
misc_notes:
type: string
description: VM Notes Misc
title: VM Notes Misc
resources:
Cloud_Network_1:
type: Cloud.Network
properties:
name: QSNetwork
networkType: existing
constraints:
- tag: ${input.network}
Cloud_vSphere_Machine_1:
type: Cloud.vSphere.Machine
image: ${input.os}
cpuCount: ${input.vcpuCount}
totalMemoryMB: ${input.totalMemoryMB}
name: ${input.vm_display_name}
hostname: ${input.vm_dns_name}
vm_snapshot: ${input.vm_snapshot}
misc_notes: ${input.misc_notes}
owner: ${input.owner}
description: ${input.description}
category: ${input.category}
networks:
- network: ${resource.Cloud_Network_1.id}
assignment: static
You'll notice in yellow I'm requesting direct input from othe requester then attaching that input as properties on the VM. If you want this Blueprint you can get it here.
I then skinned this Blueprint with a Custom Form that looks like this.

This Custom Form has two tabs, the first one is for VM name, CPU, Memory, etc. The second tab is for the VM Notes.

I've given the user clear guidance on what needs to go in the field, including a Constraint that forces the user to enter a proper email address in the Owner field. You could also use a Value Source to bind a previously entered field to the value of another field via Custom Forms.

Custom Forms are super valuable for things like this, if you haven't tried them I encourage you to do so! Now when a user goes to request a VM using this Blueprint it looks like this.
Once deployed it looks like this, notice the Notes Tile.
This required a new Subscripton calling a new vRO Workflow to parse the input data and place it on the VM like we want it. The Subscription looks like this, very similar to our previous one, just calling a different vRO Workflow.

The new vRO Workflow calls two Scriptable Tasks that look like this.
If you want this vRO Workflow you can get it here. Now once deployed, the VM looks like this.

Two different ways to do the same thing, hope this was helpful, enjoy!



Comments