Well my hope is that you have already read through the Enabling the Event Broker that was posted in January. Then were thirsty for more and more around the Event broker. If you recall, in that post we covered the basics of consuming the payload from vRA 7 and utilize it just like we did the “Workflow Template” that used to exist in the 6.* days of vRA.

In the days since Enabling the Event Broker was posted I’ve built out some really powerful use cases as you can see by reviewing other more advanced Event Broker postings like Due to high demand, here’s the combined AAA deployment!, and New disk on a new SCSI adapter at request time. The issue is that it came to my attention by comments and customer meetings that I shouldn’t just be building out great use cases but enabling vRO template based examples.

So here we are with part 2 and in this post we will focus on Adding or Updating properties as the example. I will assume that you have followed the Enabling the Event Broker which will have your property groups already built out to pass all of the needed properties from vRA to vRO.

As I frequently do, if you want to follow along via video feel free to view this

***Note – You will notice there has been a bit of a change to my folder structure due to some standardization internally. Basically the team and I have decided that between us “Experts” (I use that term loosely) we will all build our content in a standardized layout so when you use stuff from Daily Hypervisor or VMtoCloud that you will have the same layout and limited reproduction of content.

While you can still use the examples from the original post you will likely get more out of the package I’ve posted here or here!

Then import into vRO and follow along step by step.

First let’s look at what’s included in the package you’ve downloaded.

Expand out the VMware -> SDE-SET -> Common -> vRealize Automation folder. In there you’ll find the folder we are going to base this post on. Expand Property Examples and the workflows you need for examples are all in this folder.

If we review the Add or Update properties for vRA example you’ll see the standard scriptable task which pulls in the payload (properties) and logs those. There are also 3 lines added to the end of that and an output of virtualMachineAddOrUpdateProperties with a type of properties. The benefit of this is that you can pass any number of value pairs back to vRA during the Event Broker execution.

virtualMachineAddOrUpdateProperties = new Properties ();

virtualMachineAddOrUpdateProperties.put(‘VirtualMachine.Network0.Name’, ‘dvPortGroup’);

virtualMachineAddOrUpdateProperties.put(‘custom.example’, ‘just a simple example’);

Reviewing these 3 lines you can see we are defining the property, updating an existing property, and creating a new property. These should help you as a starting point.

Now that we have looked at those to understand what’s going on let’s jump into vRA and work through the subscription. Go to Administration -> Events -> Subscriptions and +New

Select Machine provisioning

Run based on conditions

All of the following

Expand Data-Lifecycle state-Lifecycle state name

Equals and I’m choosing BuildingMachine as the example but this could be used at any of the events

Expand Data-Lifecycle state-State phase

Equals and I chose POST for the example

Choose your workflow “Add or Update properties for vRA”

IMPORTANT Select Blocking this is the only way vRA will accept the output from vRO to add or update properties

Publish the subscription you just created

Now time for some verification work. Based on Enabling the Event Broker you should have a trigger on all events subscription if not repeat the steps above and make sure this is published.

This is the walk through to verify you have something collecting the payload at every event

Run on all events

Get properties (don’t worry it’s just logging so we can verify the add or update worked)

Doesn’t need to block, but make sure it’s PUBLISHED

Now all you need to do is put the request for your catalog item in and let’s look at the workflows as they execute.

First we look at the event on request and notice there are no custom.example

And our VirtualMachine.Network0.Name is set to VM Network

When our Add or Update is kicked off we can see it successfully ran

Now let’s look at the logs collected after the Add or Update was run

Notice we now have a custom.example (Which was created)

And our VirtualMachine.Network0.Name is set to dvPortGroup

I chose these very specifically to illustrate something that you likely have or could use in your environment but mostly I wanted to provide you with a sampling of what you can accomplish and how much easier it is than the good ole days of v.6

Having completed this and previously completed the Enabling the Event Broker you should now be able to collect and update any of the custom properties in vRA 7 using the Event Broker!

As always please let me know any feedback, thoughts, concerns, or kudos.

Like this: Like Loading...