top of page
Brock Peterson

vRA Workload Placement and vCenter Folders

You've deployed VMware vRealize Automation (vRA), you're building VMs, and you want to put them in certain vCenter Folders, how do you do it? Here are three options:

  1. Associate the vCenter Folder with the vRA Cloud Zone.

  2. Create a Resource Action that moves the VM to a specified vCenter Folder.

  3. Request the vCenter Folder as Input upon deployment.

The first option is the easiest, but requires a Cloud Zone for each vCenter Folder. When creating a Cloud Zone, you can select the Placement Policy and the Folder (vCenter Folder) for VMs created in this Cloud Zone.



The DEFAULT Placement Policy is to deploy VMs onto random ESXi Hosts, but there are other options: BINPACK, SPREAD, and ADVANCED. Click the information bubble to the right of the dropdown for explanations.


If you leave the Folder dropdown empty, the VM will be put into the base folder for that Cloud Zone's Datacenter. Upon deployment, it'll look like this in vCenter. The VMs I deployed are in the green box, as you can see they are in the base folder.



If you want your VMs put into a vCenter Folder upon deployment, simply give it a Folder name in the Cloud Zone.



Upon deployment, you'll find your VMs in that Folder, see below. Note: you'll need a Cloud Zone for each vCenter Folder and that Folder must already exist.


If you don't like this approach, let's consider Option 2, which is the Resource Action, found in theDesign tab of Cloud Assembly. Resource Actions allow you to take Actions (via vRO Workflows) against Resource Types, in this case VMs. Let's create one to move VMs to vCenter Folders.



First give the Resource Action a Name, Display Name, Description and Activate it, making it available in Cloud Templates. Scope the Resource Action such that it's available only to certain Projects or all Projects.


The Resource Type is the VM, in this case Cloud.vSphere.Machine. The Workflow is the vRO Workflow that will perform the action, in this case "Move virtual machine to folder".


Finally, you can Require Conditions to make this Resource Action available, we'll leave this off, requiring no conditions.



Your Resource Action calls the vRO Workflow, which interacts with your vCenter/s. Let's confirm vRO has been configured, click the waffle top right.



Select Orchestrator, you will then be presented with vRO.



vCenters are integrated with vRO via a Workflow, specifically the "Add a vCenter Server instance" Workflow.



Select RUN on the "Add a vCenter Server instance" tile and you'll be presented with Properties to complete. You'll give the Workflow your vCenter IP/FQDN

and credentials.



Click RUN and you're vCenter will be added.



You can confirm your vCenter was added via Administration - Inventory - vSphere vCenter Plug-in.



Now that we have our Resource Action and the vRO Workflow it calls configured, let's run it against a previously deployed VM.



I've deployed a VM (name ending in ...937), it's sitting in the base vCenter Folder and I'd like to move it. We can do this a couple different places: directly from the Deployments page or from the Deployment itself.



Select the Move VM to Folder Action, give it the VM name and the vCenter Folder you want to put it in.



Click SUBMIT and your VM will be moved to the destination Folder.



If there are issues, or you would like to see more about the Resource Action you just took, go to the deployment and the History tab.



If you don't like these options, we could request the vCenter Folder as input upon deployment, this is our third option. My Cloud Template looks like this.



Under the Code tab you will see the YAML.

vCenter_Folder:
    type: string
    title: vCenter Folder
    description: vCenter Folder the VM will be put in
    default: vra_vm_folder

This is based on the Input tab.

Click on that Input will show the details.


Deploying a VM with this Cloud Template looks like this.



You'll notice this VM (ending in ...394) is in the vra_vm_folder vCenter Folder.



There are other things we can do, but these are the first three ways I'd put VMs into vCenter Folders. For more information on vRA go here!






3,243 views

9 Comments


kyle.bragdon
Nov 01, 2023

Hello sir, Love the post as this is essentially what I am looking for but I am encountering an issue when the folder is not a top level folder. Example: Project_Name(IAM as an example)/Active Directory/Production I can place it in the top level folder, but I cannot go any deeper. I cannot get Option 1 to work either. Can you provide some direction on how this works? I had a very similar issue in the 7.X version before we got the Solv Labs plugin.

Like

Brent Carnegie
Brent Carnegie
Sep 06, 2023

Hi Brock


Is it possible to use a VRO to bring up a list of Folders in vCenter so the user requesting a VM can select the destination folder?

Like
dale
Oct 19, 2023
Replying to

I added the code to my GitHub repository if you want to copy the code from there.


https://github.com/dalehassinger/unlocking-the-potential/blob/main/VMware-Aria-Automation/Actions/action-vcenter-folders.js


Edited
Like

Timothée Christin
Timothée Christin
Feb 15, 2023

Hi Brock,


Thanks for the post. For the third solution I don't see how you automate the move into the folder. You're only showing the input but I don't see any mapping anywhere...

Thanks for your feedback. Best,


Tim.

Like
Brock Peterson
Brock Peterson
Jul 24, 2023
Replying to


Like
bottom of page