Lab Guide: Deploying Applications with Ansible
A guide to deploying applications to Linux hosts using a job template and verifying the installation with ad-hoc commands.
Lab Briefing
This section provides an overview of the lab challenge and instructions for getting started.
Challenge Summary
In this challenge, you’ll deploy applications to your Linux hosts using a pre-created Job Template named Deploy Application.
After launching the template, you will monitor its progress. Finally, you will use Ansible Automation Platform’s ad-hoc command capability to verify that the application was installed correctly. This built-in functionality allows operations teams to get value right away without needing to write a full Ansible Playbook.
Lab Guide: Hands-On Tasks
Estimated time to complete: 15 minutes
Your assignment is to deploy applications using the Ansible Automation Platform.
Task 1: Deploy Applications with a Job Template
In this task, you will launch a pre-configured job template and use a survey to specify which applications to deploy and on which hosts.
-
Navigate to the Automation Controller UI.
Click on the Automation Controller tab at the top of your lab window.
-
Log in with the provided credentials.
Username
adminPassword
ansible123! -
Navigate to the Templates page.
In the left navigation menu, go to Automation Execution → Templates.
-
Launch the "Deploy Application" job template.
Find the
Deploy Applicationtemplate in the list and click the Launch icon (🚀). -
Complete the survey.
You will be prompted with a survey. Configure it as follows:
-
In the first field, the default application is
httpd. Addnginxto the list of applications to install. -
In the second field for hosts, the default is
rhel1. Addrhel2to also install the applications on the second host. -
Click Next.
-
-
Review and finish the job.
On the Review screen, observe the job details and the extra variables generated by the survey. Click Finish to launch the job.
-
Monitor the job progress.
The job will take a few moments to complete. The output will confirm which applications were installed on each host.
Task 2: Verify Installation with an Ad-Hoc Command
Now, you will run an ad-hoc command to confirm that the nginx service was installed and is running on both hosts.
-
Navigate to your inventory hosts.
In the left navigation menu, go to Automation Execution → Infrastructure → Inventories, click on
AWS Inventory, and then select the Hosts tab. -
Select hosts and run a command.
Select the checkbox next to both
rhel1andrhel2, then click the Run command button. -
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. Click Next. -
Execution Environment View: Select
Default execution environment. Click Next. -
Credential View: Select
RHEL on AWS - SSH KEY. Click Next.
-
-
Launch the ad-hoc command.
On the Review screen, click Finish.
-
Observe the output.
The job will complete in a few moments. The output will list both hosts and provide details about the
nginxservice, confirming its status.
Conclusion
Thank you for taking the time to learn about automating cloud operations tasks in AWS 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.
Troubleshooting
If you have encountered an issue or have noticed something not quite right, please open an issue on GitHub.
