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

Deploying Services Using Ansible

Ansible is frequently used to manage software configuration and deployment. This exercise allows students to deploy and configure an NFS server using key features of Ansible.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Advanced
Last updated
Sep 19, 2025
Duration
1h 30m

Contact sales

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

    Create the necessary template files on the Ansible control node.

    Create the files exports.j2 and etc.hosts.j2 in /home/ansible with the noted content:

    /home/ansible/exports.j2

    {{ share_path }} *(rw)
    

    /home/ansible/etc.hosts.j2

    127.0.0.1	localhost {{ ansible_hostname}}
    {{ nfs_ip }}	{{ nfs_hostname }}
    
  2. Challenge

    Create a playbook for the server 'nfs' in the Ansible inventory.

    Create a playbook in /home/ansible/nfs.yml that meets the provided specification for the server nfs in the ansible inventory.

    Create a playbook in /home/ansible/nfs.yml with the following content: - hosts: nfs become: yes vars: share_path: /mnt/nfsroot tasks: - name: install nfs yum: name: nfs-utils state: latest - name: start and enable nfs-server service: name: nfs-server state: started enabled: yes - name: configure exports template: src: /home/ansible/exports.j2 dest: /etc/exports notify: update nfs handlers: - name: update nfs exports command: exportfs -a listen: update nfs

  3. Challenge

    Add a play for the remote host group.

    Edit /home/ansible/nfs.yml such that changes are executed on the remote host group to meet the provided requirements.

    Edit /home/ansible/nfs.yml to contain the following content after the nfs play: - hosts: remote become: yes vars: nfs_ip: "{{ hostvars['nfs']['ansible_default_ipv4']['address'] }}" nfs_hostname: "{{ hostvars['nfs']['ansible_hostname'] }}" vars_files: - /home/ansible/user-list.txt tasks: - name: configure hostsfile template: src: /home/ansible/etc.hosts.j2 dest: /etc/hosts.nfslab - name: get file status stat: path: /opt/user-agreement.txt register: filestat - name: debug info debug: var: filestat - name: create users user: name: "{{ item }}" when: filestat.stat.exists loop: "{{ users }}"

  4. Challenge

    Execute playbook to verify your playbook works correctly.

    Execute playbook /home/ansible/nfs.yml to verify your playbook works correctly.

    Run ansible-playbook /home/ansible/nfs.yml from the control node.

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