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

Getting Started with Ansible

The very first step to harnessing the power of Ansible is configuring your environment. This activity goes over installing Ansible on a control node and configuring two managed servers for use with Ansible. We will also create a simple inventory and run an Ansible command to verify our configuration is correct. *This course is not approved or sponsored by Red Hat.*

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 25, 2025
Duration
30m

Contact sales

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

    Install Ansible on the control node.

    To install Ansible on the control node, run sudo yum install ansible.

  2. Challenge

    Configure the `ansible` user on the control node for ssh shared key access to managed nodes. Do not use a passphrase for the key pair.
    1. To create a keypair for the ansible user on the control host, run the following:
    • sudo su - ansible
    • ssh-keygen (accept all defaults: press enter for each prompt)
    • Copy the public key to both node1 and node2.
    • As the ansible user on the control host:
      • ssh-copy-id node1 (accept the host key if prompted, authenticate as ansible user)
      • ssh-copy-id node2 (accept the host key if prompted, authenticate as ansible user)
  3. Challenge

    Create a simple Ansible inventory on the control node in `/home/ansible/inventory` containing `node1` and `node2`.
    • On the control host:
    1. sudo su - ansible (if not already ansible user)
    • touch /home/ansible/inventory
    • echo "node1" >> /home/ansible/inventory
    • echo "node2" >> /home/ansible/inventory
  4. Challenge

    Configure sudo access for Ansible on `node1` and `node2` such that Ansible may use sudo for any command with no password prompt.
    • Log in to node1 as cloud_user and edit the sudoers file to contain appropriate access for the ansible user:
      • ssh cloud_user@node1
      • sudo visudo
      • Add the following line to the file and save:
      ansible    ALL=(ALL)       NOPASSWD: ALL
      
    • Repeate these steps for node2.
  5. Challenge

    Verify each managed node is able to be accessed by Ansible from the control node using the `ping` module. Redirect the output of a successful command to `/home/ansible/output`.
    • To verify each node, run the following as the ansible user from the control host:
      • ansible -i /home/ansible/inventory node1 -m ping
      • ansible -i /home/ansible/inventory node2 -m ping
    • To redirect output of a successful command to /home/ansible/output:
      • ansible -i /home/ansible/inventory node1 -m ping > /home/ansible/output
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