Utilizing the vCAC workflow template

*Warning before we begin, in this post I am making the assumption that you are not using vCD as an endpoint. If you are then I recommend skipping this tutorial all together.

Today we’re going to focus on the included vCAC Plugin in vCO, and more specifically how we can start to take the default “Workflow template” and make it usable as the wrapper that will be called to execute any number of automation tasks based on properties from vCAC.

If you would rather just download a workflow template and move on to the next session feel free to do so here.

In the vCO client navigate to the “Workflow template”. The path should be Library->vCloud Automation Center->Extensibility->Workflow template. Now right click and select Duplicate workflow.
1 Create Duplicate

Name your workflow and select what folder you would like it to be placed into.
2 Name and location of new template

Edit the new workflow.
3 New Workflow Edit

Select the vCloudVApp and hit the red X to remove it from Input tab.
4 Remove the vCloudVApp

Go to the Schema tab and edit the script
5 Schema and edit default script

Select the vCloudVApp and hit the red X to remove from the In tab.
6 Remove unneeded imputs

Now highlight and delete the script references to vCD. This should be lines 3-8 in the script.
7 Remove script references

Alter the “Got vCloud VM ” line to read “Got vCenter VM ” (this isn’t required but something I like to do to keep consistency).

This is how I like the final script to look, I added the vmName as variable for potential future use cases. Then click Close.8 Script config

Now Save and Close, the validation will detect unused entities. This is normal so you can click Continue anyway.
9 Save and Close

I always Increase the version to manage version control.
10 Increase version

Your template workflow is now ready to be duplicated and used to execute any logic based on the vCAC properties that are collected!
11 New Template Ready

34 comments

3 pings

Skip to comment form

  1. Hi thanks for good guide, just to let you know that it is impossible to import workflow, the error is “Not a valid package file, dunes-meta-inf is missing! “

    1. That’s because what I exported was a single workflow not a package. If you go into your run or design where each workflow is listed then right click on a folder and import workflow. That should work for you.

    • Dustin on August 1, 2014 at 6:58 pm
    • Reply

    I assume this template would be the beginning of a new workflow i’m creating. So for example If I have a workflow that will take the VRM owner and add it to the local admin. How would I map the properties needed to run my workflow from the template? I see it pulls the vCACvmproperties already, do I call that somehow?

    1. Dustin, if you look at this example you will see the same type of use case.

      https://extendingclouds.com/2014/04/28/how-bout-we-let-users-set-their-default-admin-or-root-password/

      You can skip the decision or any of the linux commands but for the windows you will use the same program you will just build a new arguments variable to pass the user.

      Hope that helps!

    • Dustin on August 1, 2014 at 8:10 pm
    • Reply

    That does help and I’ve got mine setup similary to how you’ve suggested, but I could use any input. Unforunately my work doesn’t allow any sort of file upload, but if you’ve got time and are willing to look at my work and possibly give feedback?

    I’ve got another thread opened on the vmware vcac communites that I was able to upload my workflow to.

    https://communities.vmware.com/message/2411123#2411123

    1. Here’s how I would have done it.

      https://www.dropbox.com/s/zqgfjifwmjx5tza/test%20workflow%20for%20Dustin.workflow

        • Dustin on August 1, 2014 at 9:06 pm
        • Reply

        Wow thanks for the quick reply. Unfortunately the reason I was using the workflow I linked, is it removes the UPN from the username. I’ll take a look at this and see if I can go from there and make it work on mine.

        1. In that case I would add the following lines to the script
          var str = vCACVmProperties.get(“__Legacy.Workflow.User”);
          var user = str.replace (“@domain”,””);

          then replace the + vCACVmProperties.get(“__Legacy.Workflow.User”) + with + user + on the arguments line

    • Dustin on August 4, 2014 at 3:06 pm
    • Reply

    It doesnt’ seem to like the var user = str.replace (“@domain”,””);

    If I want to pull more properties would I just mirror your var str = vCACVmProperties.get(“__Legacy.Workflow.User”); with different properties and just name a new variable?

    So If I wanted to put some logic in this based off my environment, add the correct domain to the username?

    for example

    var environment= vCACVmProperties.get(“environment”); ?

      • Dustin on August 4, 2014 at 8:26 pm
      • Reply

      So I’m playing with the workflow template and I’m just trying to do a simple workflow to verify it works. All I’ve added to the template is this:

      var user = vCACVmProperties.get(“__Legacy.Workflow.User”);
      System.log(“Got Owner ” + user);

      I just want to verify this works and displays the owner. However when I kickoff this script, I get an error Invalid attribute type: Properties. I feel like I’m so close right now. I don’t know if it matters, I don’t think it should but I’m running a vco master/child setup and this is kicking off the workflow from the master, to the child. So far it’s failing before it can even kickoff the script off the child vCO.

      1. Are you trying to kick off that workflow from vCO? Because it’s designed to be kicked off based on a state change it will not work unless you initiate it during a state change from vCAC.

        This will illustrate how to make a state change assignment.
        https://extendingclouds.com/2014/03/02/vcac-vco-a-marriage-made-in-the-clouds-part-3/

        • Dustin on August 4, 2014 at 8:38 pm
        • Reply

        There’s no reply under your message, weird. But yes I’m kicking off this workflow from a MachineProvisioned state change. It errors out with error Invalid attribute type: Properties.

        I just wanted to thank you again, your blog and input has been very valuable and more worthwhile than this consultant my company hired to teach this stuff. Thanks again.

        1. No problem, hopefully I’ll see you at my VMworld sessions later this month 😉

          The properties error usually is due to you calling a property that doesn’t exist. Couple of quick tests to execute can you run just the standard vcac template workflow without any of the additional logic you added? If so then it’s something in the logic added.

        • Dustin on August 4, 2014 at 9:03 pm
        • Reply

        I’ll definitely try and get in your session!

        So I tried to run a basic template, after removing the vCloud stuff, I added the vmName = vCACVm.virtualMachine; like you said for future uses and It errors out with “Invalid attribute type: Properties”. This is all being done through MachineProvisioned stub.

        1. Ok I need to look at some of my workflows to verify but I think your issue is with the case. Try vCACVm.VirtualMachine

          Notice the capital V in virtual. vCAC + vCO = very VERY case sensitive on all the custom and defined properties.

          Try that and let me know

        • Dustin on August 5, 2014 at 1:08 pm
        • Reply

        Ok so after looking at the the workflow template the syntax is actually correct with vCACVm.virtualMachineName. That’s what it says at least at the top of the template that comes in by default. I tried running literally the basic template, minus the vCloud stuff that I removed and it still fails with Invalid attribute type: Properties.

        All i’ve added was this to the bottom of the of the scriptable task…

        var user = vCACVmProperties.get(‘__Legacy.Workflow.User’);
        System.log(“Got Owner ” + user);

        vmName=vCACVm.virtualMachineName;
        System.log(“Got VM Name ” + vmName);

        Any chance you could upload a copy of your blank template? One that you use that’s ready to start scripting with? Just so I could compare.

        1. You are right, sorry for the confusion. I took my standard workflow and added the logic to pull the VRM user out. Take a look at this workflow and it should give you the illustration you need.

          https://www.dropbox.com/s/8i4dgsv6xz801bq/Request%20Wrapper.workflow

    1. Yes for environment that is how you would get any assigned value. You will need environment set on the blueprint in vCAC for that property to be passed.

      https://extendingclouds.com/2014/04/28/how-bout-we-let-users-set-their-default-admin-or-root-password/

      This is the example of using custom properties to pass into your vco workflows

    • Dustin on August 4, 2014 at 8:34 pm
    • Reply

    Do you possibly have any idea why I’d get an error “error Invalid attribute type: Properties” when running this?

    • Dustin on August 12, 2014 at 5:53 pm
    • Reply

    Gary,

    You’ve been a big help so far and i’ve been able to leverage the template how you’ve said. One thing I’m getting stuck on right now is how to update the vCACVm name in vCAC. I can run my BuildingMachine workflow stub correctly and generate the name how I want, but I’m getting stuck at updating the vCACVm name. It just outputs a default machine prefix name at this point.

    1. It sounds to me like you are attempting some very specific custom host naming and then trying to inject that back into vCAC. The only way to do that would be to use the update vCAC entity workflow. That said there is a much more elegant way to go about that. If you use the following link
      http://dailyhypervisor.com/vcloud-automation-center-vcac-5-2-custom-hostnaming-extension/
      You should then be able to grab the hostname that is created during that workflow as an alternative.

    • dean on October 2, 2014 at 5:59 pm
    • Reply

    Thanks very much for this post. I am having some trouble understanding where you get the vCACVm.virtualMachinename setting from I have tried to recreate the workflow but I get a java.lang.NullPointerException error.

    It looks like the VirtualMachineName = vCACVm.virtualMachineName;is wrong so I am wondering if the vCACVm.virtualMachineName is built in or I have to define it somewhere?

    1. Are you trying to run the workflow manually from vCO or have you assigned it to a blueprint and requested through vCAC? It will not work unless kicked off by vCAC at that point the value that you reference will be defined.

        • Dean on October 2, 2014 at 7:27 pm
        • Reply

        Hi thanks for the reply, yes it’s assigned to a blue print and it runs when I provision a cm through vcac

        1. So out of curiousity, what version of vCAC are you running? I have tested this on 6.0 and 6.1 both. Can you run the workflow with the vmName line commented out or does it still error?

            • dean on October 3, 2014 at 11:34 am

            Hi Gary, doesn’t work with the line commented out, still get the same error.

            • Gary on October 3, 2014 at 11:54 am

            So that means the out of the box workflow template isn’t getting the vCAC properties passed to it from the IaaS machine. Is this a fresh install of 6.1 or an upgrade? I want to see if I can replicate. My immediate thought is your vCO-vCAC registration may be in question and you may want to run the unregister workflow and then walk back through the registration process.

            • dean on October 3, 2014 at 12:04 pm

            Its a fresh install, IaaS servers are behind a Load Balancer, I registered the IaaS host via the Load Balanced name, just as an FYI.

            • Gary on October 3, 2014 at 12:07 pm

            You happen to have time for a quick webex this morning? I would like to see the behavior.

            • Gary on October 3, 2014 at 12:11 pm

            I have about 40 minutes, send me an email at gcoburn@vmware.com if you have time to walk through the configuration this morn. If not you may want to contact GSS, I’m sure they could help as well.

    • dean on October 3, 2014 at 8:01 am
    • Reply

    We are using vCAC 6.1 and vCO 5.5.2.0 Build 1992027. I’ll try the the workflow now with the commented out part and get back to you.

    • Liang on November 26, 2014 at 2:48 am
    • Reply

    Hi Gray.
    vCO more videos:
    http://communities.vmware.com/community/vmtn/server/vcenter/orchestrator

    I’m using vCAC611 and using this workflow for a blueprint MachineProvisioned status. But the parameter vCenterVM of the workflow is NULL, while vCACVM is not. It didn’t happen for vCAC601. Is it a known issue? Thanks.

    1. Liang,

      Yes that is the same experience I have seen in the 6.1.1 release. I have not yet confirmed if our 6.2 release maintains this or not. Stay tuned and I will let you know!

        • dean on January 7, 2015 at 9:51 pm
        • Reply

        Think the 6.2 release has the same issue.

  1. […] Go to -> vCenter Orchestrator and login -> Select your workflow template, if you haven’t created that yet please see this post […]

  2. […] So firstly you are going to want to create a Workflow Template, use this step by step here from Gary https://extendingclouds.com/2014/03/08/utilizing-the-vcac-workflow-template/ […]

  3. […] directions in using my post about “utilizing the workflow template” will succeed with no issues. The larger issue is when you try to use that as a wrapper for a more […]

Leave a Reply

Your email address will not be published.