1 Reply Latest reply on Sep 20, 2019 10:10 AM by craigso

    Defining customization spec for vsphere provisioned VMs

    craigso Enthusiast

      Hello!

       

      I'm starting to kick the tires on Cloud Assembly I'm currently stuck trying to figure out how to apply the correct customization spec on a VM provisioned on a local vSphere instance. I've got the environment setup, and I can provision VMS. Now I need to apply the correct spec depending on which image type has been chosen.

       

      Here is the current blueprint:

       

      formatVersion: 1
      inputs:
        name:
          type: string
          description: Hostname
          title: Hostname
        size:
          type: string
          enum:
            - micro
            - small
            - standard
          description: Select VM size
          title: VM Size
        image:
          type: string
          enum:
            - centos
            - ubuntu
            - Windows2019
          title: Select Image/OS
        platform:
          type: string
          enum:
            - 'platform:amazon'
            - 'platform:azure'
            - 'platform:uocloud'
          default: 'platform:uocloud'
          description: Choose where to provision the resource
          title: Select a cloud
      resources:
        Virtual_Machine:
          type: Cloud.Machine
          constraints:
            - tag: '${input.platform}'
          cloudConfig:
            output:
              all: '>> /var/log/cloud-init-output.log'
            runcmd:
              - sudo mkdir /home/demofolder
              - sudo apt-get update
          properties:
            name: '${input.name}'
            image: '${input.image}'
            flavor: '${input.size}'
            remoteAccess:
              username: demouser
              password: nottherealpassword
              authentication: usernamePassword
      

       

       

      My plan of attack was to do something like this but something either this. I know this is incorrect.

      customizationSpec: ${input.platform == "platform:uocloud" && input.image == 'centos' ? "IS-Default-Linux" : ""}
      

       

       

      I am hoping I can find some way of doing a conditional statement or similar. Any recommendations?