VMware Cloud Expert

Lab 04b - ABX Actions

Updated on

Introduction

This lab demonstrates how to leverage an ABX action to conditionally set the name of the  Virtual Machine which Aria Automation will provision.  

The code uses a property that the cloud template provides, to calculate a new Virtual Machine name.

TASKS

Task 1 - Import the ABX Action
  1. From your VDI Desktop, access your Aria Automation Assembler browser tab. If the tab is closed or the session has timed out, then access Aria Automation Assembler from your browser bookmark and login using your student account (vmcexpert#[email protected] | VMware1!) if necessary.

NOTE: You created this bookmark in a previous lab. If you missed the step you can use this link - https://www.mgmt.cloud.vmware.com/. Make sure to bookmark the page for future access

  1. Login with your VMC on AWS console credentials provided by your instructor.
  2. Type <Your Assigned login Credentials> in the email address field i.e. vmcexpert#[email protected] (where # is your Environment ID, and XX is your assigned student number)
  3. Click NEXT
  4. Type VMware1! in the Password field
  5. Click SIGN IN
  6. Click the stacked squares in the upper right-hand
  7. Click VMware Aria Automation
  8. Click on the Assembler card to access Aria Automation Assembler service.
  9. If Prompted again, login.
  1. On the Guided setup Diagram page, Click Continue
  2. In Aria Automation Assembler, navigate to the Extensibility tab
  3. Select Actions in the Library section
  4. Click on IMPORT
  1. In the Import Actions popup, click on IMPORT
  2. In the file browser, select E:\Lab_Files\Day-2\abx-actions.zip
  3. Select your project
  4. Click IMPORT
  1. Click the changeHostname action to review the code

The code reads a property corp_applicationType from the virtual machine properties.  If the value is "database", then the VM name will be aadbxxxx.  If it is "web", then it will be aawebxxx.  To ensure unique VM names, the code leverages the unique number assigned by Aria Assembler.  By default, this means a name like aadb1-mcm1234455...

If you want to shorten the name, you can create custom VM names using Infrastructure->Administration->CustomNames.

  1. Click CLOSE to exit the action.
Task 2 - Create the Subscription
  1. Navigate to the Extensibility tab
  2. Select Subscriptions on the left.
  3. Click NEW SUBSCRIPTION
  1. Set the name to {Your-User-Name}_ChangeVmName i.e. vmcexpert3-01_ChangeVmName
  2. Click ADD in the EventTopic section and select Compute allocation for the topic.
  3. Click ADD in the Action/Workflow section and select the changeHostname ABX action.

Notice when adding the Action/Workflow that, on the top left, you can set the Runnable Type to ABX Action or Workflow (Aria Automation Orchestrator Workflow).

  1. Enable Blocking by sliding the slider to the right.
  2. Set the Timeout to be 2 minutes
  3. Slide the Project scope to the left to disable "Any Project".
  4. Click ADD PROJECTS
  5. Select your project i.e. vmcexpert3-01_Multi-Cloud
  6. Click ADD
  7. Click SAVE
Task 3 - Create a Cloud Template
  1. Navigate to the Design tab
  2. Under Design tab, Click New From --> Blank Canvas in the left pane
  3. Define the Cloud template as follows:
  4.        Name: {Your_User_Name}_ABX
  5.        Project: {Select_Your_Project}
  6. Click CREATE

 

  1. Add an input to your cloud template as follows:

 

inputs:
  applicationType:
    type: string
    title: Application Type
    oneOf:
      - title: Database
        const: database
      - title: Web Server
        const: web
Click to copy
  1. From the Cloud Agnostic section drag the Machine object onto the canvas
  2. Make the following updates to the properties section of the machine:
image: '{Your_User_Name}_Ubuntu'
flavor: {Your_User_Name}_Small
constraints:
  - tag: 'platform:aws'
corp_applicationType: ${input.applicationType}
Click to copy

Note the property corp_applicationType.  This is the property that your ABX action will use to compute the name of the VM.  It is recommended that you prefix your  properties with your company name to ensure uniqueness with codes from vendors and other sources.  In this example, we have just used corp.

  1. Drag the Network object from the Cloud Agnostic section
  2. On the Canvas connect the Cloud Machine to the Cloud Network by dragging a line from the cloud machine to the Cloud Network object
  3. In the Code Editor Pane add a Name & Constraint property to the Cloud Network.
name: 'net-web'
networkType: existing
constraints: 
  - tag: network:{Your_User_Name}
Click to copy
Task 4 - Deploy a Cloud Template
  1. Click TEST to validate the template.  Select Database as your Application Type.
  2. Click DEPLOY
  3. Name the Deployment {Your-User_Name}_ABX
  4. Click NEXT
  5. Select Database as your Application Type
  6. Click DEPLOY
  7. NOTE: The deployment takes a few minis to complete. You can click the History tab to monitor the steps
  8. Once deployed, Select your Cloud_Machine in your deployment.  In the properties box on the right notice the Resource name.  Instead of Cloud_Machine_1-mcm..., it should now be aadb1-mcm...  Also take note of the value of your property corp_applicationType.  This is the property that the ABX code uses to compute the VM name.
  1. Click CLOSE to close your deployment.
  2. Click the Extensibility tab.
  3. Select Action Runs under the Activity section on the left.
  4. Click on the changeHostname that matches your execution (Note:  Your partner may have runs as well.  Check that the Project column matches your project)
  1. In the Details tab on the right, evaluate the Inputs and Outputs (note:  The data is in JSON string format).  On the outputs you should see the VM name that was computed.
  2. Click the Log tab on the right to see the console log.  You should see a line "Changing first VM name from ... to ...".  This came from the console.log() in the ABX action.
  1. Click CLOSE to exit.
  2. Try deploying your blueprint again, choosing Web instead of Database and the VM name should be aawebnnnn.

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.