• Home
  • VMware QuickDocs
    • Getting Started with VMware Cloud Foundation
    • VMware General
    • vSphere
    • vSAN
    • Horizon
    • NSX
    • vRealize Suite (renamed to Aria Suite)
    • Aria Suite
      • Aria Automation
      • Aria Operations
      • Aria Operations for Logs
      • Aria Automation Orchestrator
    • Podcasts
  • Home Lab
  • VMware Stickers
  • mac OS Tips
  • About Me
    • Privacy Policy
    • Cookie policy
Cybersylum

Cybersylum

  • Home
  • VMware QuickDocs
    • Getting Started with VMware Cloud Foundation
    • VMware General
    • vSphere
    • vSAN
    • Horizon
    • NSX
    • vRealize Suite (renamed to Aria Suite)
    • Aria Suite
      • Aria Automation
      • Aria Operations
      • Aria Operations for Logs
      • Aria Automation Orchestrator
    • Podcasts
  • Home Lab
  • VMware Stickers
  • mac OS Tips
  • About Me
    • Privacy Policy
    • Cookie policy

Basic Math in an Aria Automation Cloud Template

byArron King 11.13.2023 Aria Automation

I was helping someone with a small challenge in their Aria Automation Cloud template and had to dig to find the solution.  They didn’t find any examples through a search, and neither did I –  so I thought I would share.   The goal was to do basic math (addition) in the YAML of the Cloud Template.

The use case was a cloud template adding multiple disks in a virtual machine.  They had a need to control the name of the VMDK differently than was specified in the Project Custom Naming template.    They were using an array of disks in the Cloud Template and the index of that array to make the VMDK name unique (The second disk for the vm should be called mytestvm_disk2.vmdk).

As most arrays in computing are, the index was zero-based (the second disk was called mytestvm_disk1.vmdk). While this would provide a unique name for each disk, the preference was to start with 1 to make it easier on the large number of admins who manage workloads in the environment.  They tried various ways of formatting the YAML to get the addition correct; but could not find a way that worked as expected.

I cannot share the code that this customer wrote; but have worked up a simple example to illustrate.   The use case this code sample represents is not something you would normally do; but will serve to highlight the syntax to allow some basic math in an Aria Automation Cloud Template.

Arithmetic Operation Example

In our example,  we want to prompt the consumer of our Cloud Template for a base number and will add 1 to it (BaseNumber +1).  This will be appended to the name the user enters for the VM.

Cloud Template Form

As mentioned, they attempted multiple syntax combinations to add the numbers but it kept  getting treated like a string

name: ${input.vm-name + input.Base-Number + 1}

YAML Math - Failed attempt

 

The resulting VM was named MyTest01.  This was a string concatenation, not an addition.

VM Name with base number concatenated string - instead of added

 

 

 

Aria Automation Cloud Assembly Expression Syntax allows for a number of functions.  One of these is to_number(). This allows you to use some basic  arithmetic operations and then incorporate that result.

name: ${input.vm-name + to_number(input.base-number + 1)}

 

Using this code results in a VM named MyTestVM1 – which is the result of adding a number on the form (0) with another integer value (1).

VM Named correctly after adding 2 numbers

 

 

 

 

Share this:

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on LinkedIn (Opens in new window) LinkedIn

Importing vSphere Networks into Aria Automation - Part 4 - Update Network Profiles

Using OpenSSL to create SSL Certificates for vSphere

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Disclaimer

The content and opinions on this site belong to me - not my employer.

You are welcome to use any ideas or code from this site. You have the responsiblity to test these before using in a production environment.

Upcoming Events

  • Wed
    22
    Oct
    2025

    Cincinnati VMware VMUG UserCON

    Save The Date!

    The VMware VMUG UserCON returns to Cincinnati in October 2025

Categories

Aria Automation Aria Operations for Logs Before I Forget Certificates Education Home Lab Horizon View Importing vSphere Networks into Aria Automation Linux MacOS Networking PowerCLI Professional Development Scripting Swift TechBITS Tech Learning Update Manager VCSA VMUG VMware VMware Cloud on AWS VMware Portal VMware Tools VMworld vSphere vToolBelt Windows 10

Archives

Category

Aria Automation Aria Operations for Logs Before I Forget Certificates Education Home Lab Horizon View Importing vSphere Networks into Aria Automation Linux MacOS Networking PowerCLI Professional Development Scripting Swift TechBITS Tech Learning Update Manager VCSA VMUG VMware VMware Cloud on AWS VMware Portal VMware Tools VMworld vSphere vToolBelt Windows 10
Proudly powered by WordPress | Theme: Showme by NEThemes.
 

Loading Comments...