Configure catalog item instance config to provision to a default folder

Each tenant has a folder in vCenter, we need the catalog item to default to that folder when the catalog item is ordered.

This variable in the catalog config section needs to be set to the default tenant folder in the cloud

“type”: “MSWin”,

“config”: {

“createUser”: false,

“isEC2”: false,

“isVpcSelectable”: true,

“noAgent”: false,

“smbiosAssetTag”: null,

“nestedVirtualization”: null,

“vmwareFolderId”: “/”,

“resourcePoolId”: “<%= customOptions.selectedrespool %>”,

“poolProviderType”: null

},

Is it this bit that is required to be substituded with the default folder that is currently assigned to the tenant that is provisioning the catalog?

1 Like

yep, should be a value like group-vxxx

The following configuration works if we are setting the default folder in Morpheus.

  1. Navigate to Infrastructure >> Cloud >> select VMware cloud >> Resource.

  2. Under ‘Folders’, Click ‘Actions >> Edit’ on the folder that you want to assign to a specific tenant.

  1. Search for the tenant you want to assign this folder to, and check the default checkbox next to it and save changes.

  1. On the JSON config for the catalog item, remove the ‘vmwareFolderId’ attribute completely and save the catalog.

When provisioning with this setup Morpheus will automatically create the VMs in the default folder assigned to the tenant on step 3.

This is really useful , would the same apply to the resource pool?

No this does not apply to resource pool. You have to specify the resource pool in the catalog item’s JSON config. However you can set a default resource pool per cloud in Morpheus.

I was thinking perhaps remove from the json and set as default then it should work?

Removing the resource pool from JSON config will not work as Morpheus doesn’t automatically assign the default pool when ordering the catalog item.

But you can use custom options list with the following endpoint and translation script to get the default pool set on the cloud.

Endpoint:
api/zones/cloud_id_here/resource-pools

Translation Script:

for(var x=0;x < data.resourcePools.length; x++) {
    
    poolName = data.resourcePools[x].name;
    poolId = data.resourcePools[x].id;
    isDefaultPool = data.resourcePools[x].defaultPool;

    if (isDefaultPool){//Get default pool
        results.push({name:poolName,value:poolId});
    }
    
}

Hey Wabbas,

Just got around to revisiting this, although I have a work around which is having a resource pool field in the catalog item that displays the only resource pool that the tenant has access too via permissions on the cloud, it doesnt seem possible to create a default resource pool for a tenant , it seems you can create one per cloud but not per tenant.

Have any changes been made to allow auto select of the resource pool in the JSON or as part of the provisioning in the later versions?

This is what i have in my JSON, folder defaults by using the “/” would be useful if resource pool could do the same.

“config”: {
“poolProviderType”: null,
“isVpcSelectable”: true,
“smbiosAssetTag”: null,
“isEC2”: false,
“resourcePoolId”: “<%=customOptions.selectedResourcePool%>”,
“createUser”: true,
“nestedVirtualization”: null,
“vmwareFolderId”: “/”,
“noAgent”: false

Thanks