In my previous post, I integrated Puppet Enterprise with Cloud Assembly to be used with my vSphere blueprint for software installation during deployment. In this post I will walk you through how to use input parameters to make the blueprint more dynamic at request. For example, at request determine the size of the machine and which software to be installed by Puppet. After that we’ll release the blueprint to Service Broker.

But first, let’s explain input parameters.

What are input parameters

As a blueprint developer, you use the input parameters to customize the blueprint request so that the deploying user can provide or select value at request time.

A blueprint supports the following input data types; number, integer, string, boolean and object.

When using these, input properties can be configured to set restrictions. For example, enum, default value, minimal length, regular expression etc. etc. For a complete list of input properties and descriptions see the Cloud Assembly documentation.

In my case, I want the size of the machine (flavor), IP assignment (static or DHCP) and Puppet role to be selectable. Also, do I want the prefix of the machine name to be provided by the user.

How to use input parameters

To add input parameters is rather simple. In the inputs area of your YAML code, you add the input definitions.

inputs:
  vm_name:
    type: string
    minLength: 6
    maxLength: 12
    description: VM name prefix
    title: VM name prefix
  vm_size:
    type: string
    enum:
      - ddeswart-small
      - ddeswart-medium
      - ddeswart-large
    default: ddeswart-medium
    description: Size of the VM
    title: VM size
  ip_assignment:
    type: string
    enum:
      - static
      - dynamic
    default: dynamic
    description: IP assignment type
    title: IP assignment
  pe_role:
    type: string
    enum:
      - 'role::linux_base'
      - 'role::linux_webserver'
      - 'role::wordpress_server'
    default: 'role::linux_base'
    description: Puppet role
    title: Puppet role

Then, in the YAML resources section, you reference the input parameter with ${input.<property_name>}.

resources:
  Cloud_Puppet_1:
    type: Cloud.Puppet
    properties:
      role: '${input.pe_role}'
  Cloud_vSphere_Machine_1:
    type: Cloud.vSphere.Machine
    properties:
      name: '${input.vm_name}'
      flavor: '${input.vm_size}'
      networks:
        - name: '${Cloud_vSphere_Network_1.name}'
          assignment: '${input.ip_assignment}'

Now that we have the input code, let’s use it in our latest version of our vSphere blueprint. Click here to view the complete YAML code of my vSphere blueprint with Puppet integration including input parameters.

Adding input parameters to the blueprint

  1. Login to Cloud Assembly and open the latest version of the vSphere blueprint with Puppet integration. The Inputs section of your YAML code should be empty.input parameters
  2. Copy the above input parameters code and add it to your blueprint. Under the Resources section, don’t forget to replace the name, flavor, assignment and role resource values with the corresponding input properties just as in the example.input parameters
  3. Create a version of your blueprint by clicking on Version in the design canvas. Enter a Description and Change Log and click Create.input parameters
  4. To view your code differences, click on Version history in the design canvas. In the left menu select your latest version and click on Diff. Diff against by selecting your previous version.input parametersinput parameters
  5. Go back to the design canvas and click Deploy to test your blueprint. Enter a Deployment Name and select the latest version. Enter a Description and click Next.input parameters
  6. In the second screen, the default input values are shown as configured in your YAML code.input parameters
  7. Change the inputs as you wish. Every field with a red asterix is required. Click Deploy.input parameters
  8. Select the Deployments tab to check if your deployment was successful.input parameters
  9. Login to vSphere to check the Virtual Machine details. Then check Puppet Enterprise of the node was added. And finally check if the software was deployed by entering the IP address in a webbrowser.
    vsphere VM detailspuppet enterprise nodeswebsite up and running
  10. If your deployment was successful, delete it and release your version of the code. Click on Version history in the design canvas. Select your latest version and click Release. Enter a Description and click Releaserelease bp versionbp version released

Once a version is released it can be consumed in the Service Broker catalog.

Add your blueprint to the Service Broker catalog

  1. Login to Service Broker. At this moment the catalog is empty.
  2. In Service Broker select the Administration tab. In the left menu select Content Sources and click New.
  3. Select Blueprint as content Type. Enter a Name and Description and click Validate. If Ok, click Create & Import.
  4. Verify if the source is added and if any blueprints are imported. In my case, the vSphere blueprint was imported.
  5. In the left menu select Content Sharing. Select your Project and click Add Items.
  6. Find your blueprint and click Save.
  7. Go back to the Catalog tab. Your blueprint should now be added to the Catalog and consumable by users in your Project.

This is it. In my last five posts I showed you how to connect your on-premises environment with VMware Cloud Automation Services, setup Cloud Assembly, create a vSphere blueprint with Puppet Enterprise integration, make your blueprint more dynamic with inputs and finally release it to Service Broker.

I hope it was helpful to get some basic knowledge and hands-on experience with Cloud Automation Services (CAS).

This is not the end of this series because there are a lot of topics still to be explained. So check-in regular for new CAS content!