Lab Guide: Deploying Applications on Azure VMs
A guide to deploying applications to virtual machines in Microsoft Azure using the Ansible Automation Platform.
Estimated time to complete: 15 minutes
Lab Overview
In this final challenge, you will create and run a job template to deploy an application to a Red Hat Enterprise Linux (RHEL) virtual machine on Azure. You will then verify the installation using an ad-hoc command.
1. Task 1: Create the "Deploy Application" Job Template
First, you will create a job template with a survey that allows a user to select which application to install and where.
-
Navigate to the Ansible Automation Platform UI.
Click on the Ansible Automation Platform tab at the top of your lab window.
-
Log in with the provided credentials.
Parameter
Value
Username
adminPassword
ansible123! -
Navigate to the Templates page.
Expand the
Automation Executionmenu on the left.Automation Execution→Templates. -
Initiate the creation of a new job template.
Click the
+ Create Templatethen scroll down and clickCreate job template -
Enter the job template details.
Fill out the form with the following information:
Parameter
Value
Name
Deploy ApplicationJob Type
RunInventory
Azure InventoryProject
Product Demos ProjectPlaybook
linux/deploy_application.ymlExecution Environment
Default execution environmentCredentials
RHEL on Azure -
Save the job template.
Scroll to the bottom, click
Create job template. -
Add the first survey question.
Navigate to the
Surveytab and click the blueCreate survey questionbutton. Configure the first question as follows:Parameter
Value
Question
Enter the Linux Host you want to deploy the application toAnswer variable name
_hostsAnswer type
TextDefault answer
RHEL-ansibleClick
Create survey question. -
Add the second survey question.
On the survey page, click the blue
Create survey questionbutton. Configure the second question as follows:Parameter
Value
Question
Which application do you want to install?Answer variable name
applicationAnswer type
Multiple Choice (single select)Multiple Choice Options
nginx,gdb,httpd,nanoAfter entering the options, select the radio button next to nginxto make it theDefault option.ClickCreate survey question. -
Enable the survey.
You must enable the survey by clicking the toggle switch at the top of the survey page. The text will change from
SURVEY DisabledtoSURVEY enabled.
2. Task 2: Run the Job Template
Now you will launch the template and use the survey to deploy an application.
-
Navigate to the Templates page.
Expand the
Automation Executionmenu on the left.Automation Execution→Templates. -
Launch the "Deploy Application" job template.
Find the
Deploy Applicationtemplate and click🚀 Launch templateicon. -
Complete the survey and run the job.
You will be prompted with the survey. The default values are correct (
RHEL-ansiblefor the host, andnginxfor the application). Accept the default answers by clickingNext, then clickFinishto run the job. -
Monitor the job progress. and observe the output.
The job will take a few moments to complete. The output will confirm that
nginxwas installed on theRHEL-ansiblehost.
3. Task 3: Verify Installation with an Ad-Hoc Command
Finally, you will run an ad-hoc command to confirm that the nginx service was installed and is running.
-
Navigate to the Azure Inventories
Expand the
Automation Executionmenu on the left.Automation Execution→Infrastructure→Inventories. -
Select the Azure Inventory.
Click on the inventory named
Azure Inventory. Then select theHoststab. -
Select the host and initiate the command.
Select the checkbox next to
RHEL-ansible, then click theRun Commandbutton. -
Configure the ad-hoc command.
A wizard will appear. Fill it out as follows:
-
Details View: From the Module dropdown, select
service. In the Arguments field, entername=nginx. ClickNext. -
Execution Environment View: Select
Default execution environmentfrom the dropdown. ClickNext. -
Credential View: Select
RHEL on Azurefrom the dropdown. ClickNext.
-
-
Launch the ad-hoc command.
On the Review screen, click Click
Finishto launch the ad-hoc command. -
Observe the output.
The job will complete in a few moments. The output will show details about the
nginxservice on the host, confirming its status.
4. Conclusion
Thank you for taking the time to learn about automating cloud operations tasks in Azure using the Red Hat Ansible Automation Platform!
In this lab, you have seen how automation can be used to deploy applications and how ad-hoc commands can perform quick checks on target hosts. These same principles can be easily applied to other cloud environments.