Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Ansible Playbooks: The Basics

The playbook concept is at the heart of Ansible. Writing a playbook to configure a system to the desired state is what makes this exercise so valuable to students who are wanting to get serious with Ansible. After completing this learning activity on how to configure an inventory all the way through to a mass software deployment, students will be another step closer to an official Red Hat Ansible certification. *This course is not approved or sponsored by Red Hat.*

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 23, 2025
Duration
1h 0m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Create an Inventory in `/home/ansible/inventory `That Contains a Host Group Named `web`. The `web` Group Should Contain `node1` and `node2`
    • echo "[web]" >> /home/ansible/inventory
    • echo "node1" >> /home/ansible/inventory
    • echo "node2" >> /home/ansible/inventory
  2. Challenge

    Create a Playbook in `/home/ansible/web.yml`

    echo "---" >> /home/ansible/web.yml

  3. Challenge

    Configure the Playbook to Install `httpd` on the `web` Group

    Using a text editor, such as vim, edit /home/ansible/web.yml to contain the following text block below the line containing "---": - hosts: web become: yes tasks: - name: install httpd yum: name=httpd state=latest

  4. Challenge

    Configure the Playbook to Start and Enable the `httpd` Service on the `web` Group

    Using a text editor such as vim, edit /home/ansible/web.yml to contain the following task block after the "install httpd task": - name: start and enable httpd service: name=httpd state=started enabled=yes

  5. Challenge

    Configure the Playbook to Retrieve the Website from *http://repo.example.com/website.tgz* on Each Server in the `web` Group

    Using a text editor such as vim, edit /home/ansible/web.yml to contain the following task block after the "start and enable httpd" task: - name: retrieve website from repo get_url: url=http://repo.example.com/website.tgz dest=/tmp/website.tgz

  6. Challenge

    Configure the Playbook to Unarchive the Website into `/var/www/html` on All Servers in the `web` Group

    Using a text editor such as vim, edit /home/ansible/web.yml to contain the following task block after the "retrieve website from repo" task: - name: install website unarchive: remote_src=yes src=/tmp/website.tgz dest=/var/www/html/

  7. Challenge

    Verify the Work by Executing the Playbook Using the Inventory

    ansible-playbook -i /home/ansible/inventory /home/ansible/web.yml

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

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.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight