• Home
  • Aria (vRealize) Automation
    • On-Prem Installation
    • On-Prem Base Config
    • On-Prem Upgrade
    • Cloud Assembly
      • Cloud Accounts
      • Cloud Proxies
      • Cloud Zones
      • Custom Names
      • Custom Roles
      • Flavor Mappings
      • Image Mappings
      • Integrations
      • Network Profiles
      • Projects
      • Secrets
      • Storage Profiles
    • Service Broker
      • Content Sources
      • Service Broker Content
      • Service Broker Policies
  • vRealize Orchestrator
    • Managing Plugins
  • About
  • Contact Me
  • Archives

    • March 2023
    • February 2023
    • January 2023
    • December 2022
  • Categories

    • Aria (vRealize) Automation
    • Cloud Assembly
    • Featured Posts
    • SaltStack Config
    • Service Broker
    • vRealize Orchestrator
  • About Me


    My name is Will Hochradel, and I have been working in the technology field for over 20 years. I started Falling Through the Clouds as a personal blog aimed at providing answers to the things that go missing or fall through the cracks.

  • Follow Me On

  • Home
  • Aria (vRealize) Automation
    • On-Prem Installation
    • On-Prem Base Config
    • On-Prem Upgrade
    • Cloud Assembly
      • Cloud Accounts
      • Cloud Proxies
      • Cloud Zones
      • Custom Names
      • Custom Roles
      • Flavor Mappings
      • Image Mappings
      • Integrations
      • Network Profiles
      • Projects
      • Secrets
      • Storage Profiles
    • Service Broker
      • Content Sources
      • Service Broker Content
      • Service Broker Policies
  • vRealize Orchestrator
    • Managing Plugins
  • About
  • Contact Me

Cloud Templates and CloudConfig

March 9, 2023

CloudConfig is a great way to expand the abilities of your deployments in vRealize Automation.  CloudConfig is a standardized structure of coding that is functional across all clouds.  It utilizes CloudInit within Linux based OS’s and Cloudbase-Init within Windows OS’s.  Both utilities are free to use and rather easy to setup, so I won’t cover anything about that here.  Given that both CloudInit and Cloudbase-Init follow the same code structure, here is a great resource for code example reference.

  • CloudInit Module Reference

Cloud Configuration in Image Mappings

If you read my post about Image Mappings, you remember that we briefly discussed that we could add Cloud Configurations at this level.  I like to do this when every deployment of the given OS requires something to be done with it.  This keeps it all in one place to maintain rather than having it specified per Cloud Template.

The first line of code is to tell the CloudInit or Cloudbase-Init service what the code type is.  In this case we are using ‘#cloud-config’.  This should be the first line in your code when you are using CloudConfig coding.  As you will see in the Cloud Templates example below, I show setting it up to be PowerShell code, which may clear this up a bit.

This example shows us running a single line of runcmd that changes to the ssh directory and generates a new host key and restarts the sshd service.  This is because CloudInit by default flushes all the hosts keys when it runs the first time to prevent duplication of keys due to cloning machines.

Cloud Configuration in Cloud Templates

Here within the Cloud Template itself, we will do most of our Cloud Configuration work.  The below use case was to format and label additional disks attached to the Machine resource and then install SQL Server.  I chose to do this with PowerShell since that is an easy way to code within Windows.  To do this we need to specify the code type as ‘#ps1_sysnative’.  This will ensure that the system knows that we are executing powershell and it will take all the code listed below and create a ps1 file on the destination machine.  Once the file is copied up, it will execute the PowerShell script.

Cloud Configuration Multipart configuration

There will be instances where you will end up generating a multipart cloud configuration.  What is a multipart configuration?  Well, a multipart configuration is built for you when you have cloud configurations in Image Mappings as well as Cloud Templates.  They are pieced together when you deploy and are applied as one multipart cloud configuration. 

If you find yourself needing to run both native CloudConfig as well as PowerShell or other shell script within the same area as the Cloud Template, we need to build this multipart configuration ourselves.  Let’s look at a simplified example that we can talk through.

First, we define this being a multipart/mixed configuration and specify how we signify the beginning of a part.  Here I chose to use ===BEGIN to signify the beginning of the part.

cloudConfig: |
  Content-Type: multipart/mixed; boundary=”===BEGIN”
  MIME-Version: 1.0

Next, we create the header for the part.  We begin with our defined boundary with 2 dashes in front.  We need to specify the appropriate Content-Type, text/cloud-config for all CloudConfig code and text/x-shellscript will be for PowerShell or other shell scripting.  The last thing to pay attention to will be the filename.  For CloudConfig, leave this as cloud-config.  For your shell scripts name them what you want them to be in the file system of the deployed machine.

Aria AutomationCloud AssemblyvRealize Automation
Share

Cloud Assembly

Will Hochradel

You might also like

vRealize Automation 8.11.2: New Features and Resolved Issues
March 21, 2023
Service Broker Policies
March 18, 2023
Service Broker Content
March 14, 2023

Leave A Reply


Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • About Me


    Falling Through the Clouds is a personal blog about technologies that I am knowledgeable and passionate about.

  • Follow Me On

  • Tags

    Aria Automation Cloud Assembly OpenSSH Release Notes SaltStack Config Service Broker vRealize Automation vRealize Orchestrator


  • Recent Posts

    • Managing Plugins
      March 24, 2023
    • vRealize Automation 8.11.2: New Features and Resolved Issues
      March 21, 2023
    • Service Broker Policies
      March 18, 2023
  • Popular Posts

    • Cloud Proxies
      December 14, 2022
    • Cloud Accounts
      December 29, 2022
    • Integrations
      January 6, 2023
  • Privacy Policy

  • Contact Us


© Copyright FallingThroughTheClouds.com