How To Dynamically set your VM deployment folder

Overview

When you deploy a VM to vCenter, you select a folder in which to deploy them to. You may not want all your VM’s to deploy to the same location. We will cover off a couple of ways you can set the folders dynamically.

We will work through two different ways this can be approached.


Considerations

  • Have access to vCenter to confirm current structure and requirements

  • Understand how to create parameters in CloudBolt and where parameters can be placed

Procedure

Deploying to folders using templated items

Please read through this section and then decide on how you would like to have the folders structured. You can drive these through parameters or existing template items as seen in the images below. You can place the parameters at various levels including at the blueprint, the environment or the group so there is a bit of planning to do before making the below change.

  1. Go to your vCenter resource handlers overview tab and click on Edit Settings

  2. Edit the field named Virtual folder path with the naming/folder convention required.
    In this example we have used a default folder path of ClouBoltVMs and then set the group as the templated item. You can configure this to be completely templated if required.

  3. Once you have updated the Virtual folder path, click on save. This will then deploy your machine into a folder appropriately named. If the folder does not exist, it will create it for you.


Deploy to folders using if statements and templated items

This step requires some logic to be inputted into the Virtual folder field to do something. In this example it is an IF statement that can do the selections for you. This could be a mixture of plain text and templated items.

  1. Go to your vCenter resource handlers overview tab and click on Edit Settings

  2. Edit the field named Virtual folder path with the naming/folder convention required.
    In this example we have used an if statement to that simply checks the group and set a folder path. See the example code below.

    {% if group.name == "CloudBoltDB" %} CloudBoltVMs/{{ group }}/DBServers {% else %} CloudBoltVMs/{{ group }} {% endif %}

  3. Once you have updated the Virtual folder path, click on save. This will then deploy your machine into a folder appropriately named. If the folder does not exist, it will create it for you.

Additional information

CloudBolt Parameter Templates : https://docs.cloudbolt.io/articles/#!cloudbolt-latest-docs/parameter-templates/q/template/qid/8228/qp/1

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.