VCO Workflows from vCAC Workflows (Southbound)
I recently blogged about Powershell integration with vCAC and how easy scripts can be called from within the various machine states, see here for details. This post will provide an overview of VCAC/VCO Integration of a similar tract.
VCO is an awesome companion with vCAC, VCO has many out of the box plugins and workflows that can be simple to use & test all within the VCO design canvas. When a workflow has been created within VCO it can be easily integrated into the machine lifecycle.
This example will show you how to setup VCO Integration within VCAC, and then create & run a simple workflow in both VCO and vCAC. The following is the (very simple) functional overview of this sample:
1) Create a new Workflow in VCO which takes an input username as a workflow argument
2) A workflow output argument will be created and set with a user CostCenter being the result.
3) A vCAC State Workflow will run in the Building Machine State and call out to VCO and execute the workflow, wait and store the result as a local vCAC workflow variable.
4) The vCAC Workflow will then save the result to a machine custom property.
Setup VCO Integration with vCAC
|Create New Endpoint|
Select New Endpoint, then vCO.
|Configure name add Address which is the location of the VCO API
(Default port is 8281)
|Select New Credential|
| vCO endpoints must have a property to indicate the priority of each endpoint.
Click New Property & create property with the name VMware.VCenterOrchestrator.Priority and a value that is
greater than 0
|Click Ok to save endpop|
Create a new vCO Workflow
- Create a new workflow called GetCostCenteryUser
- Create input workflow argument:
- Name: User
- Type: string
- Name: costcenter
- Type: string
- Create a new scripting task.
- Add this within the scripting tab of the new script task:
Create a new vCAC Workflow
If however you are using the CDK vCAC Workflow Designer there will be some initial steps required to set this up.
The details on creating the workflow are as follows:
- Create a Pre-BuildingMachine workflow, meaning the VCO workflow will run prior to the machine being created.
- Set this to run if a custom property called “User.CostCenter.Name”
- In order to get a machines owner details (we will get the whole machine including some extra properties, we can query the VirtualMachineExts table):
- Create a variable calle Machine of Type “VirtualMachineExts”
- Drag an Assign activity into the Custom Code area of the worklow:
- Assign variable name = “Machine”
- Assign variable value = “mgmtCtx.VirtualMachineExts.Where(Function (v) v.VirtualMachineId = VirtualMachineId).FirstOrDefault()”
- Choose our newly created workflow called “GetCostCenterByUser”
- A list of input workflow arguments will be presented, add the user value : “Machine.UserName”
- Output workflow parameters will also be displayed, these can be bound to local variables. Create a variable:
- Name = costCenter
- Type = string
- Assign the VCO Activity costcentre to vcac variable costCenter
- Machine Id=VirtualMachineId
- Property Name=”User.CostCenter.Name”
- Property Value = costCenter
- Deploy the workflow and any associated XML files as normal
- Update a blueprint with the custom property:
- “User.CostCenter.Name” and the value can be left blank.