vRealize Automation 7 – Enabling the Event Broker part 2

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.

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.

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!

Like this:

Related

gary.coburn

Pure technologist at heart, founder of Extendingclouds, and is considered to be a cloud expert in the IT field with over 15 years experience in Virtualization, Automation, and Cloud technologies. Gary Coburn started in the industry designing and implementing large scale enterprise server and desktop virtualization environments for a global manufacturing firm in West Michigan. Later went on to become a key pre-sales/post sales resource for a Regional SI. In Aug 2010 moved to VMware and have progressively moved from Michigan Enterprise SE, to Regional Specialist, and now a National Specialist
Gary has helped dozens of fortune 100 and 500 enterprises successfully adopt both private and public cloud strategies as part of their IT offerings. The result of which was large operational and capital savings for his customers. Gary continues to help large enterprise customers reach their hybrid cloud strategies at VMware. On Extendingclouds you will find exclusive content that will help you learn how to adopt a successful cloud strategy through the use of VMware Cloud Automation Center, Open Stack, and other industry recognized cloud solutions.

More than willing to jump on a webex with you if you’d like to demonstrate the behavior. That said is this 7.0.1 fresh install or upgrade? Are both blocking tasks? Can you disable the one that’s successfully running now and see if the one not working will pull the payload?

Gary,
Is there a particular state requirements for updating any of the “__” hidden properties? I am trying to add some data to the __Notes field and it does not seem to be working at MachineProvisioned PRE or POST. I am able to update and create standard custom properties though. Any suggestions?

Now I see what is happening. I am trying to update the VM Description field and I assumed that the __Notes was it, but it looks like Description is a copy of __Notes. I guess I will have to update the vCAC entity to get the description to update in VRA. Thought there might be a shortcut there, but I guess not.

If you’re attempting to update the description of the actual deployment then that may be a bit of a challenge. I’m not sure that the vCAC entity will even do it. Since the Event Broker doesn’t allow for any interaction at the deployment level I have only seen that updated via an API call. Take a look at http://dailyhypervisor.com/vrealize-automation-custom-hostnaming-extension/ for the example to jump off of.

I am unable to retrieve _number_of_instances payload property value, if I set deployment limit to 1 or set it to any maximum number it will fail to retrieve instance value. If I remove value from deployment limit as blank, then I am able to get properties value for _number_of_instances. Could you please let me know how can I retrieve value if I set deployment limit.