Welcome to 2016 and my first in-depth post about the new Event Broker in vRA7. As you will see through out the coming posts I’m VERY excited by the Event Broker. The power and flexibility that it will provide can only be matched by your imagination.
Examples of this are a number of folks when they first got hands on started doing really creative things like, when a blueprint changes trigger the cloud client to export the blueprint for version control, or as you will see in a future post I created an install of app authoring agent on a pristine OS so the agent isn’t preloaded. Venture out and look at some of the great blog posts and you will see just how great this feature is going to be!
Sadly it’s not a feature that your customers (i.e. business users) will see or hear much about. You won’t get rave reviews because of how great it is… However the power it holds for you, for me, for the automation of all your infrastructure and application needs is something you will grow to love. Not to mention vRA becomes even more powerful out of the box. If you would rather watch a walk through of what I’m posting below in video format and understand more about how EB compares to the vRA 6 workflow stubs, please review this video.
First let’s get the Pre-Reqs out of the way, below you will see a link the vRA 7 package for your consumption and a spreadsheet that illustrates the step by step process for a clone/linked clone provisioning process.
- vRO Package – https://developercenter.vmware.com/samples?id=961
- There is this updated package which follows naming standards that we are adopting as we develop more content. Feel free to use this but a few screenshots will be different. All of the example workflows now live in VMware -> SDE-SET -> Common – vRealize Automation – Property Examples (formerly the workflow template)
- Spreadsheet of state changes – https://docs.google.com/spreadsheets/d/1l1dg6Elx3Z1Z8zPcKjyuUKbBiTP__yCktQ8XB7Sa6SY/edit?usp=sharing
Import the Package included above into vRO. As a result you should see the following workflows created.
Next log into vRA and let’s jump right into the configurations needed. Again what we will do from here through the rest of the post is configure vRA 7 to use the Event Broker like a simple state change stub that was available in vRA 6..
Go to Administration -> Property Dictionary
Go to Property Groups -> +New
Set the following
Name: (I’m using key state changes)
ID: Will populate automagically
Properties: Fill in the following entries with * as the Value and make them all overridable
This will pass the appropriate properties to vRO so that your workflows can utilize them like you did with the WorkFlow template and assigning the State Change workflow.
If you would like to understand more about the different events triggered and the timing of each please see the link to the spreadsheet.
Here’s an example of how your Properties should look.
Next go to Design -> Blueprints and select the blueprint you are going to use for provisioning.
Select the blueprint on your canvas, go to the Properties tab and click add on the Property Groups sub tab.
You should see the listing of the Property Group you created. Select it and click ok.
For validation purposes select the View Merged Properties to evaluate the settings. Click finish when you’re done.
Go to Administration -> Events
Go to Subscriptions -> +New
Select Machine provisioning
For this example we are going to Run on all events. This is only for the examples here, in future education sessions we’ll dive into being very selective about what gets run and when it gets run. There will be an entire post or perhaps two on that subject.
Select the EB Get Custom Properties Example
Now this is very important, DON’T FORGET TO PUBLISH… I say that in all caps because I have forgotten dozens of times already!
Go to Catalog and Request your item
Drill down to the machine and review the properties. As you can see they should be all set and ready to go.
Just for the sake of this example which we will build on in later sessions let’s change the value of the Requested from * to *__* and submit the request.
Be patient, after a few moments go back to your Orchestrator Client, expand the workflows that have run and select the first. Review the Logs to see what the state is, what the properties passed are.
Now if you click on each you will see the first 2 runs will in-fact be the same because they are Requested-Pre, Requested-Event, and Requested-Post. On the Fourth entry you will see the WaitingToBuild which if you recall we didn’t create a property for. Now notice that there are NO custom properties being passed.
Finally to illustrate the full list we jump down to the 7th run and if you review all the output in the Logs you will see a full list of the properties passed. Why???? Because at the BuildingMachine state we passed a * value which collects and passes ALL parameters.
Now that we have completed this exercise you should be feeling like you have a solution that operates much like vRA 6 did. More importantly you should be starting to see why there is so much power in this new Event Broker. In our next post we’ll do a basic install at MachineActivated. Each post will build on one another so that you get to feel more comfortable each time. If you’re anything like me by the 3rd or 4th post you will be REALLY EXCITED by the power of the Event Broker!
Thanks for viewing and don’t hesitate to hit me up with thoughts, questions, or feedback!
Thanks Gary. Very informative
Stay tuned my friend next session will be posted in the next day or two and will include running an install!
Thank you for the great post, Gary !
A small remark – you don’t need the vRO enpoint in the Infrasctructure tab – this is only needed for the legacy(CDK) extensibility, which is not suported in 7.0.
The XaaS component which triggers the vRO workflows is using the vRO as configured in Administration -> vRO Configuration -> Server Configuration. This by default is bound to the embedded vRO instance.
Ventsyslav, Thanks for the comment/assistance. I will update the post to reflect that!
Great Stuff, Just curious, how exactly can I force a Request to fail from my workflow.
In my case I made a workflow to create corresponding CMDB entries and return a hostname.
I want the flow to fail if VRO cannot communicate (via REST) to the CMDB interface.
Glad the site is helping you! Take a look at the link below column E illustrates what will happen if your vRO workflow fails. I personally recommend that in your case I would subscribe to onRequest -> PRE so that it will fail without a provisioning happening at all.
Thanks. I am trying to follow the below execution, please let me know if my understanding is correct or not ?
1) I will insert an incident/cmdb in Service Now using insert workflow. This insert operation is basically creates an incident for requesting a VM provisioning. In the description part of the incident I will fill up the some properties/parameters of vm ( for example , vm name , number of cpu, memory etc).
2) Now I would like to request a service catalog ( already predefined BP and definitely the Property Group ( & the Event Broker Subscription is configured ) from another Workflow.
3) Now I need to get the Status of the request ( vm provisioned successfully or failed ) through the Even Broker Subscription and after getting the status I would like to update the status of the incident in service now. So, I thought after executing the BP, the Event Subscription WF will automatically executed with the payload from vRA. but this is not happening my side.
Can you please help me out ?
Koushik, have you looked at the link by fetacloud in my More Expert Posts about service now?
That would give you the step by step to enable what I think you’re asking for.
Yes, I have checked that already but thing is that after requesting the service catalog item from vRA the event subscription is not invoked at my end. There is no error I am getting as well. Can you please let me know how to proceed ?
Forgive me this may be very simple but did you validate that you have published the subscription. I myself have had many times that I created a subscription and realized I missed the publish. If you have done that, please verify in vRO if the workflow is running at all.
Thanks, now event subscription is working fine at my end with your example (package).
But I am trapped in to set the custom properties of VM during catalog item request. Below is the code I am using at my end. Here I am using “setFormValues” to set the custom property values. These values are basically coming from user input (vmname, cpu no,memory etc). Also I would like to set the ‘sys_id’ as a custom property so that after vm is provisioned I can get the value of sys_id from payload of vRA subscription.
After getting the sys_id, i would like to update the same record in service now. Can you please check my code and let me know where I am doing the mistake.
In the below code, item is the catalog item for already published BP. If i not set any custom properties then the catalog item is requested fine but it is throwing error if i am trying to set any custom property like below.
Please let me know your suggestion.
var form = vCACCAFERequestsHelper.getRequestFormForCatalogItem(item);
System.log(“Accepted inputs: form : ” + form);
var fields = vCACCAFERequestsHelper.getFormKeys(form);
System.log(” fields length >>- ” + fields.length);
for (var i = 0; i >- ” + fields[i]);
var input = new Properties();
System.log(“Filling in catalog item request…”);
form = vCACCAFERequestsHelper.setFormValues(form, input);
System.log(“Sending catalog item request…”);
var request = vCACCAFERequestsHelper.requestCatalogItem(item, form);
Koushik, The methodology for updating a property in vRA 7 is much different and easier than before. First you want to make sure that you have the check box enabled for blocking task on the event subscription. Then in your workflow you need to add an output virtualMachineAddOrUpdateProperties with a type of Properties. With your scriptable task you will set the property like this.
virtualMachineAddOrUpdateProperties = new Properties () ;
You can use this for the reserved properties like the CPU above, you can also create your own like the service now ID. That said make sure to use something like custom.servicenow.sys.id so there’s no chance that sys.id is reserved any place.
Thanks for your response. You are absolutely correct. The things is vRA7.x have been changed.
I have modified my codes and now able to execute all the scenarios perfectly at my end ( with event notification and subscription). Also I can able to talk to service now.
Again, I would like to thank to you for all of your help and assistance. Specially this topic is really helpful for me to understand the new features in vRA.
Please continue with such excellent work so that we all will be really helpful.
Koushik, Glad I could help. Thanks to us trading messages here, you’ve inspired me to post a new intro to updating and adding custom properties.
Thanks for your response and you are most welcome. I have some another thought in my mind that can’t we automate the manual configuration steps ( which we follow in vRA ) from some workflow in vRO.
I would like to know is there any way I can automate the things ( the manual configuration work done in vRA like property group creation, Event subscription creation, etc) via some workflow from vRO ? is that possible to implement/call some API in vRO to get all these done from vRO side?
Please give me some idea on this.
Koushik, Yes absolutely there are teams internal at VMware who are using vRO as a means to do things like create or publish catalogs and entitlements. An example of some of that work is the initial configuration that is run by the configurationadmin account. That workflow is in vRO and literally creates endpoint, fabric group, business group, blueprint, and entitlements!
I would like to execute two workflows (vRO external workflows) one after another for the same event change in vRA through EBS. For example I would like to execute WF1 first and then WF2 next once the state change event “MachineProvisioned” havppened in vRA. Can I achieve this via EBS ? In case of a single EBS can I point the two WF’s ? I think it’s not possible. I need to create two EBS for that two WFs but how can I determine which EBS/WF will execute first ? Can you please help me out on this ?
Koushik, The event broker operates by priority first so if you assign a WF1 andWF2 to the same MachineProvisioned for example the one with the lower priority will execute first. Secondarily if two have the same priority it will execute in alphabetical order. It’s also worth note if you want to wait for WF1 to complete before WF2 trigger you will probably want to set blocking on that particular subscription.
So the simple answer is yes you can subscribe to as many different workflows with the same state. This is some of the amazing power with EB vs. the old state change methodology from version 6.
In vRA 6 you need to the *ExternalWorkflowsxmldb folder and create some extra xml plugins for the other prio’s 2 till 7. But how do you give a workflow the priority number in vRA 7? I dont see the option in the event broker GUI
The priority is set at subscription time for the event broker. Priority defaults to 10 if all workflows are set to 10 then it will go in alphabetical order. If you want 1 workflow to run before another give it a lower priority number i.e. 9, 8, 7, etc…
Thanks for your valuable suggestion.
I need your help to find out how can we get the values of two properties from the EBS payload in vRO workflow? We have used the below properties in previous version of vCAC 6.1. These properties coming with vCAC virtual machine in vCAC 6.1 now we need to retrieve these properties from payload in vRO workflows . Can you please help me out how to get the values of these properties from payload (coming from EBS in vRA 7.0 ) in vRO 7 workflow.
a) isComponent (it determines vm is component of multi machine)
b ) blueprintType ( determines the type of blue print)
Another thing is that, the EBS is well tested in case of Multi machine Blue Prints ?
Koushik, I am sorry to say that there is no easy or out of the box way to do this with the current version of vRA and EB. If you will notice with MMBP there isn’t a way to manipulate the parent object so it’s essentially useless because EB only triggers on the individual VMs within that MMBP. Fundamentally we have some internal workarounds that may help you but it would be making vRA do unnatural things and not sure I would recommend it as a long term solution. I will add that this is a KNOWN issue and our product team is looking to get this fixed in 7.1 (fingers crossed)
Thanks for your suggestions and comments. I am trying to execute the MMBP with EBS and let’s see the results.
I will keep you posted in case if I face any issue.
Thanks once again for your valuable time and suggestion.
Hi Gary – it’s a very useful guide to get started with EB. But I noticed you mention there are other articles to come thru on EB. Would you please post them when you get a chance.
Amir, Glad it helps and to be perfectly honest just about every one of the posts I’ve done are directly using the Event Broker. Take a look at all of these posts
And there is currently one under development for custom notifications.
Great, thank you again. I will go thru those.
No problem I hope all the posts help you!
Need your help. I am to execute a custom workflow using an EBS. And I tried to request more than one deployments (say 4 deployments) in catalog item request. After submitting the request , total 4 request is triggered and the custom workflow is running simultaneously with 4 instances. As a result, some of the run instance is failed and it is disturbing the final output. Now, i wanted to restrict the running of the wf simultaneously. I have already set “Blocking” yes for that workflow but not working. Can you please help me out on this ?
Thanks once again for your help.
Kousik, Sorry to hear you’re having issues. Without knowing what exactly is going on it’s hard to give you an exact fix. That said let’s discuss blocking, a blocking task is only on a per instance basis so if you have 4 running in parallel each one would execute that particular workflow and wait till it finishes before executing the next phase on each instance. There isn’t a means to do 1 instance and wait, then the second and wait.
The best way to go about doing what you’re looking for is in your vRO workflow set it to lock at the beginning and unlock when that process completes. Then the next deployment will queue and execute.
Thanks for your comments. I also tried to implement the locking mechanism as you suggested but couldn’t get any success. I have posted a detailed message/log to vmware Orchestrator community. Below is the link. Can you please also have a look on this (as per your available time) ?
Thanks once again for your assistance.
Great post, big help in making the move from vRA/vRO6 to vRA/vRO7
Glad to help!
in vRA6 we needed to use a property set and a customization spec to add a windows computer to a domain along with removing it from the domain upon decommission.
Can you do a post on performing these in vRA7.
Thanks for the request and it’s something I will put on my post request list. I’m not sure how quickly I’ll be able to pull it together due to VMworld and other schedules. That said it actually is something I’m sure you could do pretty easily. The steps using EB would be to add a powershell host and have it run a DNS add script which would take your name variable. Then use AD vRO workflows to add and remove VMs at specific events. Give it a shot and let me know, I’ll be happy to help as much as possible.
hi, thanks a lot for your sharing. It’s very helpful.
Could you please share the workflow, which is called “lifecycle extensibility – on provision example with v.6” as well? The picture in your video is not clear enough.
Thank you very much.
Shirley, first off my apologies for the blurriness, I didn’t realize it was that bad. Sadly I cannot share the workflow example with all the steps because it was a customer workflow and has data that I can’t distribute. Perhaps this image will work better for you? https://www.dropbox.com/s/hr44t1v7nas2tu8/Shirley.png?dl=0
thanks for the leg up. How did you find the related information? Im struggeling to get the correct CustomProperties for the events:
I utilized the default workflow that just collects properties and ran it at every event. I believe with the reconfigureVM that it falls into the lifecycle event topic, not the machine provisioning topic.
You’ll also notice for the properties in my examples that the spreadsheet has specific properties that need to be associated with the blueprint. For each of the properties that have EVENT in them you need. Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.VMPSMasterWorkflow32
I too am interested in knowing how you generated the “vRA 7 EB Statechange Order” spreadsheet. Would you be able to post the workflow/script block that you used?