One of the things that I like about vCAC , is the ability to run workflows in each different stage of the machine provisioning. This enables us to do a lot of the manual work that usually occurs when a machine is requested in our organisation , automatically with vCAC workflows. In order to take advantage of the full vCAC workflow capabilities, we will need a CDK license for our vCAC instance. “CDK” is actually an acronym for “Cloud Development Kit”.
What the CDK actually does is allow us to upload new workflows to the database, using the cloudutil.exe utility, installed when we install it and the vCAC Designer. Also, it will install a Visual Studio plugin for us, allowing us to easily create new xaml files (Microsoft’s .Net Workflow file format) with all the stuff we need to run in vCAC. The installation is fairly simple (Just remember to put the vCAC Web Server FQDN name, and the 443 port ), so I’ll jump to the more important stuff.
Before we get started, I must say I know there are quite a bit of “how to create a custom workflow” posts, but I posted this with the intent of showing some interesting fact I found regarding an “On” state workflow specifically. Lets get started!
To create a new workflow, we will open Visual Studio (needs to be 2010/2012) and create a new project
The new project should be of a type C# workflow, as seen on the right pane, and I usually choose activity library, which is simply an empty workflow file.
Now, we will click the vCAC Workflow Generator from the tool menu. If you’re seeing it as greyed out, just click the Add-In Manager, uncheck the tool, and try to select it once more from the tool menu.
After that, we’ll see the workflow menu popping up. Here, we’ll click the two “Add” buttons, in order to generate a new workflow xaml file in our project, and also so we can add the necessary references from vCAC dll’s so we could use the vCAC CDK activities.
our second menu will require us to enter a workflow name, and type. Yes I named mine “AppDeployMonitoringAgent” as a hint to what will this workflow do. Generally, naming workflows with good names is a real best practice, as things get complicated once we run a lot of custom workflows. The workflow is a “StateChange” workflow, since it will activate once a machine’s state had been changed to an “On” state.
Also, I’ve put a good Custom Property name as indication that the workflow should run. “App.Deploy.MonitoringAgent”.
Next step is to grab the workflow files from the project’s folder, and do the following:
1. External-<Name of workflow>.xml
– Put this file in the vCAC Manager Server, at: <vCAC Install Directory>\Server\ExternalWorkflows\xmldb
Example: C:\Program files (x86)\VMware\vCAC\Server\ExternalWorkflows\xmldb
Attention! – In order to run an “On” state workflow, you need to edit the file , and replace the
from “On” , to “^On$”. Why? Well, vCAC will catch the machine’s state with RegEx, so by catching the phrase “On” we’re actually running the workflow at “InitialpowerOn” and “TurningOn” states as well… This could lead to unwanted workflow results. The replaced value will make sure that the workflow will run only once the machine is up and running.
After replacing the value, and putting the file in the xmldb folder, you should restart the vCAC Manager Service.
2. <Name of Workflow>.xaml
– Grab the file from the project’s folder, and put it somwhere it would be easily accessible from command line.
– Open a command prompt and navigate to <vCAC install folder>\DesignCenter
– We will use the cloudutil.exe file (AKA “vCAC Designer”) to enter the command:
[powershell]cloudutil.exe workflow-install -f workflowfilename.xaml -n workflowname[/powershell]
A good install would look like this:
That’s it, you’ve now installed a new workflow in the vCAC Repository and can access it from the “Load” button in the designer. We can now edit the workflow to do whatever we want, usually it’s going to be some powershell activity in an “On” state. But, I’ve got even more interesting scenarios for this machine state than you think. Find out in my next post!
BTW, do not forget to add the custom property you gave your workflow in the desired blueprint.