Using Ansible Modules to Manage Scheduled Tasks in Your Environment

15 minutes
  • 3 Learning Objectives

About this Hands-on Lab

Cron jobs are tools that help system administrators automate tasks. The downside is that configuring them across hundreds of systems is a daunting task. Ansible has a module to help here as well. This hands-on lab will help you understand how that module is configured.

*This course is not approved or sponsored by Red Hat.*

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Write a Playbook to Create a Weekly YUM Update Job in Cron

Your playbook entry for this job should look similar to this:

  - cron:
     name: "Weekly YUM Update"
     special_time: weekly
     job: "/usr/bin/yum update -y"
Write a Playbook to Execute /usr/bin/status on Reboot

This section of your playbook should look like this:

  - cron:
     name: "Reboot Status"
     special_time: reboot
     job: "/usr/bin/status"
Write a Playbook to Execute /usr/bin/faillock_report at the Required Time

This section of the playbook should look like this:

  - cron:
     name: "Faillock Report"
     job: /usr/bin/faillock_report
     weekday: "1,3,5"
     minute: "30"
     hour: "7"

Additional Resources

Recently the security was breached on the webservers in your environment. One of the postmortem findings was that the breached servers were not up to date with current security patches. Because of this, you've been tasked with writing an Ansible Playbook to set up three cron jobs, and then running the playbook on every server in our environment.

Here are the three cron jobs:

  1. Running yum update weekly.
  2. Execute /usr/bin/status upon reboot to check in with your monitoring system and give a current status of critical services and their package versions.
  3. Running /usr/bin/faillock_report at 7:30AM on Mondays, Wednesdays, and Fridays to report excessive login attempts.

Note: Please allow extra time for the lab to finish provisioning before connecting to the server. All tasks will need to be executed as the root user.

This course is not approved or sponsored by Red Hat.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?