Lab Guide: Automating OS Patching on AWS
A guide to creating a job template with a survey to perform OS patching on EC2 instances.
Lab Briefing
This section provides an overview of the lab challenge and instructions for getting started.
Challenge Summary
In this challenge, you’ll perform OS patching on a Red Hat Enterprise Linux virtual machine running in AWS.
You will also use a Survey. Surveys set extra variables for a playbook in a user-friendly, question-and-answer format, making your automation more interactive and flexible.
Lab Guide: Hands-On Tasks
Estimated time to complete: 15 minutes
Your assignment is to create a Job Template to perform OS patching on EC2 instances. In this example, you will patch a Red Hat Enterprise Linux server and generate a viewable report.
Task 1: Create and Run the Patching Job Template
You will start by creating a job template, adding a survey to make it interactive, and then running it to check for available patches on the Linux host.
-
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.
-
Initiate the creation of a new job template.
Click the Create template button, then select Create job template.

-
Enter the job template details.
Fill out the form with the following information:
Parameter
Value
Name
Linux PatchingJob Type
CheckInventory
AWS InventoryProject
AWS Demo ProjectExecution Environment
Default execution environmentPlaybook
playbooks/lab2-patching.ymlCredentials
RHEL on AWS - SSH KEYTo select the credential, you may need to first filter the Credential Type to Machine. -
Save the job template.
Scroll to the bottom and click the blue Save button.
-
Add a survey question.
Navigate to the Survey tab and click the Create survey question button. Configure the question as follows:
Parameter
Value
Question
Enter the Linux Host you want to patchAnswer variable name
HOSTSAnswer type
Multiple Choice (single select)Required
Check the box ☑️
Multiple Choice Options
rhel1Click the radio button next to
rhel1to make it the default option, then click Create 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 OFFtoSURVEY ON.
-
Launch the template.
Click the Launch button in the top right.
-
Complete the survey and run the job.
You will be prompted with the survey question. Since
rhel1is already the default, click Next, review the details, and then click Finish to run the job.
We set the Job Type to Check. This runs the playbook in "dry run" mode, showing what changes would be made without actually applying them. The job output will point to the patch reports, which you will examine in the next task.
|
Task 2: View the Patching Report
The automation job generates HTML reports detailing the available patches.
-
Locate the report URLs in the job output.
The output from the
Linux Patchingjob will contain URLs for the generated reports. They will look similar to this: -
View the reports.
Copy and paste each URL into a new browser tab to view them. The
linuxpatch.htmlreport provides a detailed list of all package updates that would be installed or removed if the job were run in normal mode.
| While this challenge focuses on Linux, Ansible Automation Platform can be used to perform Windows patching with similar workflows. |
