vRA Workload Placement and vCenter Folders
Updated: Apr 27, 2022
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:
Associate the vCenter Folder with the vRA Cloud Zone.
Create a Resource Action that moves the VM to a specified vCenter Folder.
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
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!