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
- 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
- Login with your VMC on AWS console credentials provided by your instructor.
- 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)
- Click NEXT
- Type VMware1! in the Password field
- Click SIGN IN
- Click the stacked squares in the upper right-hand
- Click VMware Aria Automation
- Click on the Assembler card to access Aria Automation Assembler service.
- If Prompted again, login.
- On the Guided setup Diagram page, Click Continue
- In Aria Automation Assembler, navigate to the Extensibility tab
- Select Actions in the Library section
- Click on IMPORT
- In the Import Actions popup, click on IMPORT
- In the file browser, select E:\Lab_Files\Day-2\abx-actions.zip
- Select your project
- Click IMPORT
- 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.
- Click CLOSE to exit the action.
- Navigate to the Extensibility tab
- Select Subscriptions on the left.
- Click NEW SUBSCRIPTION
- Set the name to {Your-User-Name}_ChangeVmName i.e. vmcexpert3-01_ChangeVmName
- Click ADD in the EventTopic section and select Compute allocation for the topic.
- 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).
- Enable Blocking by sliding the slider to the right.
- Set the Timeout to be 2 minutes
- Slide the Project scope to the left to disable "Any Project".
- Click ADD PROJECTS
- Select your project i.e. vmcexpert3-01_Multi-Cloud
- Click ADD
- Click SAVE
- Navigate to the Design tab
- Under Design tab, Click New From --> Blank Canvas in the left pane
- Define the Cloud template as follows:
- Name: {Your_User_Name}_ABX
- Project: {Select_Your_Project}
- Click CREATE
- 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
- From the Cloud Agnostic section drag the Machine object onto the canvas
- 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}
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.
- Drag the Network object from the Cloud Agnostic section
- On the Canvas connect the Cloud Machine to the Cloud Network by dragging a line from the cloud machine to the Cloud Network object
- 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 TEST to validate the template. Select Database as your Application Type.
- Click DEPLOY
- Name the Deployment {Your-User_Name}_ABX
- Click NEXT
- Select Database as your Application Type
- Click DEPLOY
- NOTE: The deployment takes a few minis to complete. You can click the History tab to monitor the steps
- 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.
- Click CLOSE to close your deployment.
- Click the Extensibility tab.
- Select Action Runs under the Activity section on the left.
- Click on the changeHostname that matches your execution (Note: Your partner may have runs as well. Check that the Project column matches your project)
- 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.
- 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.
- Click CLOSE to exit.
- Try deploying your blueprint again, choosing Web instead of Database and the VM name should be aawebnnnn.
0 Comments
Add your comment