Hi all. We have a new vCO+vCD 5.1 environment setup in my organization and I want to setup a simple workflow to Instatiate X number of vApps from a chosen template.
I'm to total noob/beginner here. The library workflow "Instantiate vApp from Template" does exactly what I want it to do, but for just one vApp.
Any thoughts directions as to what high level steps I would need to take to customize that workflow to "loop" a certain number of times based on input?
It's easy enough to add a new input and presentation screen to capture the number from the user, but I really have no idea where to start on the loop.
One thing I want to avoid is for one full vApp to be created and started up and all tasks complete, and then it starts the next iteration of the loop (that would take forever). I'd prefer to instantiate the full number of vapps together and wait for them all to complete, and then move on to starting them all up at once and waiting for all the startups to complete.
Any thoughts or pointers on how to come at this? (again, total noob).
Thanks, in advance!
Here are the step by step instructions on top of my head. There are certainly other easier ways to do this.
Create a workflow.
Drag & drop the instantiate a vApp Template workflow
Right Click / Copy wf presentation.
-> You have wrapped the instantiate workflow in a parent workflow.
You can now remove the instantiate a vApp Template workflow from the schema since we will be calling it with a different way.
Add the "Start workflows in parallel" workflow to your schema. Link its "wf" and "parameters" inputs with creating new workflows attributes. The parameters one does not have to be set. For the wf one set it with the I"nstantiate a vApp Template "workflow.
Add a scriptable task. In the inputs of this scriptable task add all the inputs of your workflow.
Create a "number" input in your workflow. Add it as well as input of your scriptable task.
Add an output to your scriptable box and set it to the "parameters" attribute
We now need an array of input parameters to feed our workflows.
parameters = new Array();
for (var i=0; i<number;i++) {
var wfInputParameters = new Properties();
wfInputParameters.put("vAppTemplate", vAppTemplate);
wfInputParameters.put("vdc", vdc);
wfInputParameters.put("name", name + number);
wfInputParameters.put("description", description);
wfInputParameters.put("deploy", deploy);
wfInputParameters.put("powerOn", powerOn);
wfInputParameters.put("eulaAccepted", eulaAccepted);
wfInputParameters.put("runtimeLeaseHours", runtimeLeaseHours);
wfInputParameters.put("storageLeaseHours", storageLeaseHours);
wfInputParameters.put("linkedCLone", linkedCLone);
parameters.push(wfInputParameters)
}
On the schema you should link.start -> sriptable task -> start workflows in parallel
Here are the step by step instructions on top of my head. There are certainly other easier ways to do this.
Create a workflow.
Drag & drop the instantiate a vApp Template workflow
Right Click / Copy wf presentation.
-> You have wrapped the instantiate workflow in a parent workflow.
You can now remove the instantiate a vApp Template workflow from the schema since we will be calling it with a different way.
Add the "Start workflows in parallel" workflow to your schema. Link its "wf" and "parameters" inputs with creating new workflows attributes. The parameters one does not have to be set. For the wf one set it with the I"nstantiate a vApp Template "workflow.
Add a scriptable task. In the inputs of this scriptable task add all the inputs of your workflow.
Create a "number" input in your workflow. Add it as well as input of your scriptable task.
Add an output to your scriptable box and set it to the "parameters" attribute
We now need an array of input parameters to feed our workflows.
parameters = new Array();
for (var i=0; i<number;i++) {
var wfInputParameters = new Properties();
wfInputParameters.put("vAppTemplate", vAppTemplate);
wfInputParameters.put("vdc", vdc);
wfInputParameters.put("name", name + number);
wfInputParameters.put("description", description);
wfInputParameters.put("deploy", deploy);
wfInputParameters.put("powerOn", powerOn);
wfInputParameters.put("eulaAccepted", eulaAccepted);
wfInputParameters.put("runtimeLeaseHours", runtimeLeaseHours);
wfInputParameters.put("storageLeaseHours", storageLeaseHours);
wfInputParameters.put("linkedCLone", linkedCLone);
parameters.push(wfInputParameters)
}
On the schema you should link.start -> sriptable task -> start workflows in parallel
Thank you so much for the quick reply. This has given me a great set of first steps. I've give it a go, and let you know if I have any questions.
Thanks again!
~Calder
Yep, I got the loop working today as per your instructions. Worked like a charm! I was able to clone and startup 20 WinSrvr2k8 Oracle instances inside of 5-10 minutes.
Thanks again for the pointers!