Changing Source Image on the fly

Hello All,

I am currently playing around with Morpheus and I am trying to make a form that I can have the consumer fill out information such as plan size, OS they need among other things. I noticed when I go to the catalog item I presented and select let’s say Windows 10 from the populated list no matter what it deploys the virtual image source Server 2022. Is there a way or has anyone found out how to change this on the fly so that I dont need separate blueprints for each OS a person might select. I deal with about 200+ templates because we develop in multiple languages and versions and I would like to be able to use one form and just switch out what virtual image it uses as a source based on the selection from the user. See screen shot of what I am talking about and thank you in advance.

image

Forgive me as I am still relatively new to Morpheus and am doing my best to use the correct terminology.

Hi @cory244!

There are many ways to tackle your question, which primarily relies on how you’ve built your Instance Types (if using custom ones) and the virtual images associated with them via layouts and node types or just using the generic technology specific instance types (VMware, AWS, etc.) and choosing the virtual image.

In the example below, I’ll use the VMWARE instance type, which allows you to choose the virtual image:

When I create an Instance Catalog Item and use the Configuration wizard, I choose the above Instance Type and choose all the other default items I’d want, just as if I was deploying an Instance using Provisioning > Instances > Add
Example:

Once I have my Catalog Item created with the JSON in the CONFIG area, I can now either utilize Forms or Inputs to inject/override the default values. In this example, I’ll use Forms, since it has a field for this already.

If you create a new Form, you can add an Input of “Virtual Image” found under “Provisioning”:

You can attach your Form to your Catalog Item:
image

Once attached, you can see the Form’s fields to the right side when you are editing your Catalog Item:
image

I can drag the “Virtual Image” field, into the config to use the value in the config to overwrite values. For example:

  • Before:
    image

  • After:
    image

:exclamation: Note that this particular field does not have the “Auto Inject” option like some other fields may. In those cases, you don’t need to replace the values in the config, just having the field on your Form will do all the work.

There are other places that may also reference the previous virtual image id (5991 in my example above), and for good measure, I usually replace them all but really this is the one that matters for making the change. If you used a custom input (not using the Form like we did), you’d want to make sure your input is providing the ID as the value.

Save the Catalog Item and go to deploy:


image


image

As I said in the beginning, there are many ways to achieve this depending on the structure of your Instance Types but this should illustrate how to replace the config values in general too, which would be applicable.

Here are some additional resources:

Hope that helps!

3 Likes

Ah yes! Thank you that is what I was looking for and it was starring me in the face I appreciate the response!