VMware Cloud Community
bluefocus01
Contributor
Contributor
Jump to solution

How to distinguish between "Destroy" and "Reprovision" for vRO Workflows?!

Hi there,

I'm struggling around with this special issue.

We have some vRO subscriptions in vRA to clear DNS-Records and AD-Computer Accounts after destroying deployments. In case of destroying something this is working fine.

But in case of reprovision we often get timing issues. If a computer account gets deleted and recreated shortly afterwards, it often happens that the "create AD Account" Job fails and and the new deployed VM joins into a wrong OU (default OU Computers) to AD where many of our necessary GPOs are not linked.

My big question is. How can vRO distinguish between reprovision and a completely unprovision (destroy)??

Because the cleanup job should only run if I give a destroy request

Or how should I setup the conditions for the subscriptions.

I've tried: VMPSMasterWorkflow32.Disposing and VMPSMasterWorkflow32.Unprovision -> both states seems to be used in reprovision AND destroy. Therefore -> useless for my purpose.

I need a condition which can differentiate between destroy and reprovision.

Does anyone have any ideas?

Many Thanks in advance

1 Solution

Accepted Solutions
sbeaver
Leadership
Leadership
Jump to solution

This is what I am doing for this use case....

First step was to create a subscription based on an event to reprovision  "VMPSMasterWorkflow32.Active.EVENT.onReprovision"

The subscription will launch a workflow that will open a change request to reprovision and then I add some properties to the vm entity that the re-build and the DECOM part of the process will look for

"VirtualMachine.Reprovision" = true

"VirtualMachine.SNoW.Reprovision.chgID"

"VirtualMachine.SNoW.Reprovision.chgNUM"

I have used these properties as criteria for other subscription like release IP, DNS ect.  Those subscription will not fire for any reprovision requests. Same rules apply for the build and requesting IP ect.

Once the rebuild is complete then the end of the workflow will remove those reprovision properties before being released back to the customer

Hope this helps

as for the pre-create of AD accounts I have been using this solution for a while now and it has been working well for me:  GitHub - dailyhypervisor/ad-computer-management: Workflow package to add / remove computer objects f...

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**

View solution in original post

5 Replies
daphnissov
Immortal
Immortal
Jump to solution

Reprovision isn't a state like the others because it's a day-2 action that can be enabled and executed. Therefore, you'd have to use an Active Event which is called onReprovision to trigger specific behavior.

0 Kudos
bluefocus01
Contributor
Contributor
Jump to solution

hmm... in my special case i have less ToDo's in case of reprovisioning.

Therfore my trigger must be able to say vRA to skip some following workflows... I'm not sure if this is possible.

As I can see in documentations there are only 4 Active Events:

  • OnExpireLease [Expire] (Active)
  • OnForceExpire [ForceExpire] (Active)
  • onReprovision [Reprovision] (Active)
  • onResetBuildSuccess [ResetBuildSuccess] (Active)

Maybe a can use this onReprovision event to pin a additional custom property on the vm?!

Sorry I didn't use active events so far.

PS:

Are we the only one who wants to pre-create AD-Accounts in suggested OU? What would be the best and most stable solution for this?

0 Kudos
sbeaver
Leadership
Leadership
Jump to solution

This is what I am doing for this use case....

First step was to create a subscription based on an event to reprovision  "VMPSMasterWorkflow32.Active.EVENT.onReprovision"

The subscription will launch a workflow that will open a change request to reprovision and then I add some properties to the vm entity that the re-build and the DECOM part of the process will look for

"VirtualMachine.Reprovision" = true

"VirtualMachine.SNoW.Reprovision.chgID"

"VirtualMachine.SNoW.Reprovision.chgNUM"

I have used these properties as criteria for other subscription like release IP, DNS ect.  Those subscription will not fire for any reprovision requests. Same rules apply for the build and requesting IP ect.

Once the rebuild is complete then the end of the workflow will remove those reprovision properties before being released back to the customer

Hope this helps

as for the pre-create of AD accounts I have been using this solution for a while now and it has been working well for me:  GitHub - dailyhypervisor/ad-computer-management: Workflow package to add / remove computer objects f...

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
DanieleUlrich
Enthusiast
Enthusiast
Jump to solution

Hi bluefocus01

I had to solve a similar issue for a customer of ours. Basically it boils down  to the problem that you'd like to find out what the original user resource action request is.

Check out my solution to this problem:

Re: How to get the ResourceActionRequest from the EventManager Payload (reconfigure task)

Hope it helps.

Cheers

Daniele

0 Kudos
bluefocus01
Contributor
Contributor
Jump to solution

Hi sbeaver,

Perfectly, now it works. Thanks for the hint!