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

Understand Core Components of Ansible - Inventories and Facts

The key to understanding Ansible lies with beginning to actually use Ansible. Grasping the basic concepts of inventories and facts is crucial to using Ansible, both in simple and more advanced implementations. This lab will make sure you have this basic understanding of where Ansible inventory files are, and how to set them up. *This course is not approved or sponsored by Red Hat.*

Google Cloud Platform icon
Lab platform
Lab Info
Level
Beginner
Last updated
Sep 23, 2025
Duration
45m

Contact sales

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

    Fix the Ansible Inventory File

    Running ansible all -m ping results in a failure complaining about YAML parsing the inventory file. So we need to look at the Ansible inventory.

    Looking at /etc/ansible/hosts we can see that there's a comment line that isn't commented out, and that the only server listed is an example IP. Fixing the comment and changing the IP to 127.0.0.1, and then saving the file, will allow the command to work. It should end up looking similar to this:

    127.0.0.1
    
  2. Challenge

    Generate a List of Facts About the Ansible Host

    The easiest way to accomplish this task is with a one-liner:

    ansible -m setup --tree /tmp/facts localhost
    

    The ansible -m setup part grabs the facts, the --tree /tmp/facts specifies a directory for where to put the files containing these facts, and localhost is the server we're querying.

    Now if we run ls /tmp/facts, we'll see 127.0.0.1 sitting there. This file contains all of the facts about the server at 127.0.0.1. If we'd run that command with all instead of localhost, then this directory would contain one file for each server in the inventory.

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