vCloud Automation Center is the VMware hybrid cloud self-service provisioning portal. It can be customized to extend its OOTB functionality. The following tutorial shows how from the vSphere web client create a menu operation to run a program in a guest or how to do it automatically once the VM has been provisioned. This does not involve any scripting !
vCenter Orchestrator configured with:
- vCenter plug-in (with the same host used in vCAC)
- vCAC plug-in 5.2 (with the vCAC host)
- vCloud Director plug-in (no host needed for this use case)
vCloud Automation Center configured with:
- vCO endpoint
vCO integration with vSphere web client (out of the box with windows installation of vCenter, follow this guide to do it with the vCO appliance). If you do not have the integration you can still do this tutorial using the vCO client.
Running a program in a guest VM
There are countless use cases for running a program within a guest VM. For example post provisioning scripts / software installation. With the following guest operation method you do not need to have the VM accessible remotely through the network, you just need to have appropriate VM credentials.
In the vSphere web client type as below in the search field.
Right click / Run a workflow.
Enter the VM credential, select the VM.
Enter the program you want to run with its full path.Here it is a Windows VM but it could be a Linux host as well. Starting notepad remotely is not really useful but you get the idea.
Make sure it ran successfully since we will need this for the rest of the tutorial.
This step was not mandatory but we needed to make sure you have the settings right and it will also make our life easier later.
Installation of the vCAC extensibility package for vCO
The package is now part of the 5.2 plug-in. If not done already install it with searching and running the following workflow. If you did this already you can skip to the next section.
Select your vCAC host.
You can leave the defaults on this screen.
And on this one as well. You can create up to 16 vCO menus. You can run this workflow again any time if you need to change any of the settings.
Customize the menu operation
Now that we have done the basic installation we are going to customize a menu operation for our needs. Search and run the following workflow.
Select the host, the menu operation you want to customize, Enter a menu operation label
On the next page you can pick up an icon. If you use the vCO client you will see the icon but not in the vSphere client. You can customize the default authorizations (basically anyone). For display state remove “Off” since we do not want to start the workflow running the program in guest when the VM is powered off.
Assign a menu operation to blueprints and their VMs
The menu operation we customized is not yet avalable since it has not been assigned to any blueprint or VM. This is what is done in this step.
Search and run the following workflow.
Select a menu operation (the one below if this is the first you create).
Select on which blueprints you want to apply this menu. For this tutorial this must be a vCenter VM. If you need the menu to be available on existing machines provisioned from the blueprints you selected use the check mark “Apply …”
We are going to select the same workflow as we ran in the vSphere web client : “Run program in guest”
The next two check marks are important. The workflow “Run program in guest” has multiple inputs. The menu operation will pass the contextual VM to the workflow but cannot guess the other input parameters and their values. The first checkmark allows storing the inputs of the vCO workflow as properties of the blueprint so you can set their values. The second one does it for you based on the last input parameters entered when running the workflow.
If you go in vCAC, provision a VM from one of the blueprints you assigned a menu operation to (or use an existing one if you had chosen the option to apply the menu to existing VMs) you will see the “Start notepad” menu operation. You are almost ready to test it.
One extra step to set the password
With a vCO workflow that does not have a secureString input parameter you would be finished but since the “Run in guest” as a secureString password input parameter there is one additional step before you can use the menu.
Right click / edit the blueprints and / or VMs that have been assigned a menu operation.
Go on the properties tab. You will see listed several properties starting with ExternalWFStubs.WFvCOMachineMenu1 and finishing with the input parameters of the workflow you selected. The values are also set except for the password one. This is a security feature of vCO. Edit the vmPassword property and set the password for the guest OS credential vmUsername. Note that this password will be displayed in clear to vCAC accounts that can list these properties (obviously not the end users). Using the vCAC encrypt check mark is not an option since vCO will receive an encrypted password. If you want the password not to be listed at all you can simply create a new vCO workflow, add the “run program in guest” library workflow to it, right click / synchronize presentation and then move the password input as attribute and assign your password there. You can then use your created workflow in the “customize a menu operation” section.
You can now use the menu.
Great but what if you need this program to start automatically in the guest OS when the VM is provisioned ?
Assign a state change workflow to blueprints and their VMs
Search and run the following workflow.
There are six vCAC workflow stubs allowing to run external processes. In our case we need to run the workflow once the machine has been provisioned. Select the vCAC host.
Add which blueprints need to run the vCO workflow once the VM has been provisioned. “Apply machine operation …” is unnecessary since the machines already provisioned will not be any more in the “MachineProvisioned” state.
Select the “Run program in guest” workflow. Use both checkmark options to create the additional vCO inputs as properties.
Do not forget to set the password as described in the “One extra step to set the password” section.
Now wehn a VM will be provisioned from the selected blueprint, it will automatically start the “Run program in guest” workflow.
With this tutorial you should be able to extend vCAC to run any vCO workflow (existing in the vCO library, partners plug-ins, communities workflows or one you create).
This is really powerful and add a new way to consume vCO workflows:
- vSphere web client -> vCO workflow
- vSphere vCenter -> SNMP -> vCO workflow
- vCloud Director notifications and blocking tasks -> rabbitMQ -> vCO workflow
- vCloud Director extensions -> rabbitMQ -> vCO worflow
- vCenter Operations -> SNMP -> vCO workflow
- Service Manager -> vCO workflow
- vCloud Automation Center -> vCO workflow
- Your custom portal -> REST API -> vCO workflow
- Your vendor application -> SNMP -> vCO workflow
All integrations lead to vCO !