vRealize Automation 7 – Custom Email Notifications with the Event Broker part Duex

 

As promised from a few weeks ago I set out to solve the one hole I’ve found with the event broker in vRA 7. As you all know if you read vRealize Automation – Custom Email Notifications with the event broker there are lots of great ways deal with custom html notifications. The event broker exposes all of these phases to take advantage of, the issue of course is that the event broker is only part of those lifecycle phases and doesn’t tie into software components today.

Now with that said it’s important to note that I’m working with our PM team and we should see this as well as a few other gaps solved in the next major release. So with this session my goal is to enable you to utilize the custom email notifications we worked with before and provide a quality work around that will give you the ability to write an html file and then post software deployment provide an approval (again based on EB) to send the written file.

Take a gander at the video.

 

 

You can download the package used here from this link

NOTE: If you haven’t yet looked into it I highly recommend looking at the installer package like I’m using here, it makes life much easier and will be my standard delivery of packages moving forward

Once you have the package imported expand the folder VMware -> SDE-SET -> vRealize Automation -> Custom Notifications.

In this folder run the Install Custom Notifications – Post Approvals

This will execute the configuration of your SMTP settings and initiate the file write and read event subscriptions

01-custom-email-notifications--2mp4

 

First is the event subscriptions – You may leave the defaults here

02-custom-email-notifications--2mp4

 

Next is the SMTP server settings

03-custom-email-notifications--2mp4

 

Now we can review the write file code and edit as needed

04-custom-email-notifications--2mp4

 

This is the block that you will want to customize for your html file configuration

05-custom-email-notifications--2mp4

 

Next we look at the read file, nothing will need to be edited here but it is something worth reviewing as it has an approval built into it

06-custom-email-notifications--2mp4

07-custom-email-notifications--2mp4

 

From this point forward we can work in the vRA web UI. Start with the Administration -> Events -> Subscriptions, you will see the two workflows we setup with the installer.

08-custom-email-notifications--2mp4

 

Next we need to build an approval policy, go to Administration -> Approval Policies -> Add a new policy and select service catalog – catalog item request

09-custom-email-notifications--2mp4

 

Provide a name, set Status to Active, click Post Approval and + to add a new level

10-custom-email-notifications--2mp4

 

Name the new level, require for all events, and use event subscription

11-custom-email-notifications--2mp4

 

Now that we’ve created the approval policy we just entitle it to the specific software components. I am using my cloud admins entitlement.

12-custom-email-notifications--2mp4

 

Items & Approval and I have my software components in a service offering. I suggest you do the same then only these specific blueprints will trigger the approval email. Modify the Policy

13-custom-email-notifications--2mp4

 

Select the newly created policy

14-custom-email-notifications--2mp4

 

 

Now you can go request your service and will get the email notifications after the software components complete!

12 comments

Skip to comment form

    • Cameron on September 16, 2016 at 2:29 pm
    • Reply

    Have you looked into setting up an approval/reject email template using Event Broker? The templates that gets emailed out is very limited and the kb provided by VMware is just about unusable. My management would like to see more server details like how much more CPU/RAM/Storage is being requested so they don’t have to go into the vRA appliance to see what they are approving.

    1. You could utilize the work done on this post to populate and send the post approval information but not actually pass an approval as the output

    • Hag on November 7, 2016 at 5:27 pm
    • Reply

    My event broker was working then all of a sudden started throwing:
    [2016-11-05 15:34:16.622] [I] IP = null
    [2016-11-05 15:34:16.623] [I] OS = null
    [2016-11-05 15:34:16.624] [I] ipUrl is undefined
    [2016-11-05 15:34:16.882] [E] Error in (Workflow:Send custom notification – State Transition / Get Properties and apply logic (item1)#51) {
    “error”: “invalid_grant”,
    “error_description”: “Invalid username or password”
    }
    [2016-11-05 15:34:16.918] [E] Workflow execution stack:
    ***
    item: ‘Send custom notification – State Transition/item1’, state: ‘failed’, business state: ‘null’, exception: ‘{
    “error”: “invalid_grant”,
    “error_description”: “Invalid username or password”
    } (Workflow:Send custom notification – State Transition / Get Properties and apply logic (item1)#51)’
    workflow: ‘Send custom notification – State Transition’ (c2c85ba9-237c-4b29-94fc-67f0901fa55d)

    1. The fact that you’re getting null values it appears to me that you don’t have the property defined on the actual blueprint. Remember you will need the blueprint to have the custom property defined at the state you are running this.

    • Sivakumar on January 13, 2017 at 4:28 am
    • Reply

    Can such a thing be done for the approval mails? Other than modifying templates, I mean. Thanks

    1. Yes absolutely you can use pre/post approval to trigger workflows.

    • Susan on March 7, 2017 at 3:15 pm
    • Reply

    How to use pre/post approval to trigger workflows?
    Thanks for your help!

    1. Are you looking for a post on utilizing the pre/post approval workflows? As of 7.1 there were still many challenges as you can see with this event broker work, not all of the event data got passed to the pre or post approvals. I’m not entirely sure if this was solved in 7.2

    • John on October 3, 2017 at 6:36 pm
    • Reply

    Hi Gary,

    In vRA7.3 is there a way to get the “Parent ID” when provisioning a blueprint with multiple VMs and the Edge device? We are trying to capture the external IPs of the VMs that get deployed and put it in an email. We are able to get the external IPs when we run it against the VM, but we need to get it for all of the VMs in the blueprint.
    In our VCAC 6.2 environment we have a workflow that is able to use the “Parent ID” that was in the SQL DB, but the “Parent ID” is not in the SQL DB and now resides in the Postgres DB. Also the “Container ID” is used for Containers. I would like use the “payload” variable and list all the keys during deployment so we can pick what we are looking for and create the loop in our script within the workflow. IF you know where the “Parent ID” is, that would be helpful too.

    Thanks,
    John
    P.S. we spoke at VMworld 2016 in one of your small sessions.

    1. John,

      My apologies, I don’t have the 7.3 knowledge to get the Parent ID. Based on other details I’ve heard through dailyhypervisor.com and others the Parent ID is only available via REST API which means it’s not part of the payload. Sorry I couldn’t be more help 🙁

    • Mike Hagedorn on February 5, 2018 at 3:23 pm
    • Reply

    Gary, have you heard anymore if this issue has been addressed in 7.3?

    1. My experience is drifting further and further away from this, but the last knowledge I have of 7.3 is that it still doesn’t solve this problem 🙁

Leave a Reply

Your email address will not be published.