VMware Cloud Community
jsauter
Contributor
Contributor

vra 7.3 dynamic properties setting other properties using vro action

can u preset multiple custom properties definitions based on just a couple input options.  I am using drop downs for several property definitions using vro actions and it works, but if there is just one option available then drop downs are just another unnecesary step. It would be nice if they auto filled or set in another way.  Requester chooses Development and then Web. These two choices preselects 3 other definitions (network, clonefrom, puppet role class) but i still have to click drop down and select the available option.  I am using (switch case return) in the actions to select the proper property value.  I hope that makes sense.  

var vmNetwork;
if (vmType) {
switch (vmType) {
case "w": {
switch (datacenterLocation) {
case "Development": return ["vxw-dvs-283251-virtualwire-15-sid-7012-LS-Dev-Web-918"];
case "QA/UAT": return ["vxw-dvs-283251-virtualwire-29-sid-7026-LS-Test-Web-924"];
case "Stage/Performance": return ["Stage-Web"];
case "Production": return ["Prod-Web"];
case "Management": return ["vxw-dvs-283179-virtualwire-23-sid-7020-LS-Mgmt-Web-942"];
case "Sandbox": return ["vxw-dvs-283179-virtualwire-26-sid-7023-LS-SBox-Web-912"];
default : return ["No networks avalable."];
}
}
break;
0 Kudos
1 Reply
daphnissov
Immortal
Immortal

This isn't a trivial thing to do with vRO, but there is an extremely easy way to do this with the SovLabs Property Toolkit. This module is really powerful and allows you to do several things you can't normally do like updating custom properties on existing deployments. But in your case, it can also do dynamic assignment. So just like you describe you could have a CP called Environment. If a user sets Environment to "Dev" then based on that selection you can dynamically assign one or more properties whereas if the user selects "Prod" you could assign a whole different set of properties. And all this is done inside of vRA. Another use case for Property Toolkit is what I call 'property synthesis' whereby you build the value of a custom property based on other custom properties. I wrote about this use case when it comes to vCenter folder naming in vRA.

0 Kudos