Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Launch Your First Ansible Hands-On Lab For Free

Jun 08, 2023 • 0 Minute Read

Please set an alt value for this image...

What are Hands-On Labs?

Hands-On Labs is a key feature when it comes to learning practical skills. Instead of simply watching videos, Hands-On Labs deploy real environments with real-world scenarios for you to complete. By completing those scenarios, you are building skills that can be used directly on the job.
 
If you have a paid membership at Linux Academy, you can launch any of the 700+ Hands-On Labs available on our platform for as many times as you want, at no additional cost. If you’re a free Community Edition member, you will need Gems in order to launch Hands-On Labs. When you sign up for the Community Edition, you automatically receive 35 Gems.
 
Most of the Hands-On Labs in our Learn Ansible By Doing course are less than 15 Gems to launch, so you could launch at least 2-3 labs as part of this walkthrough we are doing, for free. You can also earn more Gems by referring members or taking other actions.
 

Your First Ansible Hands-On Lab

Let’s walk through an example by launching this Hands-On Lab: Writing Your First Ansible Playbook. 
 
Playbooks are the heart of Ansible. They provide a means of executing numerous tasks across any number of systems. This Hands-On Lab sets you on the path to Ansible mastery by allowing you to craft and execute an Ansible playbook. By the end of the lab, you will have created your first Ansible playbook.
 
If you haven't already, go to this link and click on “Start Hands-On Lab.” We're ready to get started!
 

Real-World Scenario to Complete

In this Ansible Hands-On Lab, we will complete the following scenario:
 
Your supervisor has asked you to find a way to automate and audit basic system configuration for new servers in your environment. Given that Ansible is already configured at a basic level in your environment, the simplest solution would be to just write a playbook for bootstrapping your new hosts.
 
Follow these instructions to complete the scenario:
 
Create a playbook called /home/ansible/bootstrap.yml to fulfill the following bootstrap requirements:
 
On all provided servers:
  1. Edit /etc/hosts to include the following entry:ansible.xyzcorp.com  169.168.0.1
  2. Install elinks
  3. Create the user xyzcorp_audit
  4. Copy the files /home/ansible/motd and /home/ansible/issue to /etc/
 
On the provided Network servers:
  • Install nmap-ncat
  • Create the user xyzcorp_network
 
On the provided SysAdmin servers:
  • Copy /home/ansible/scripts.tgz from the control node to /mnt/storage
 
The Ansible control node has been configured for you and each testing server has already been configured for use with Ansible. The default inventory has been configured to include the groups network and sysadmin. Each group includes a sample host.
 
As a result of completing the scenario and the instructions above, we’ll complete the following objectives:
  • Create a basic playbook for all servers in the Ansible inventory.
  • Add a section to the playbook for the Network servers in the Ansible inventory.
  • Add a section to the playbook for the SysAdmin servers in the Ansible inventory.
  • Execute the playbook to verify your playbook works correctly
To do this, you will SSH into the Ansible Control Node with the given credentials on the lab page. This is where you will configure the playbook which will complete the tasks in our instructions and perform the actions on the other 2 nodes.
 
Your credentials will be different than mine, but this is what they will look like on the Hands-On Lab page
Writing Your First Ansible Playbook Server Credentials for Hands-On Lab
Server Credentials

 

Learning Tools to Help You

If you’re not sure how to accomplish the objectives and tasks listed in the instructions, we provide both a written guide and videos. These were created to walk you through the scenario from start to finish so that if you get stuck going through this Hands-On Lab, you can look at the solution and keep moving forward.
 
Writing Your First Ansible Playbook Video Guide for Hands-On Lab
Video guide
 
Writing Your First Ansible Playbook Instructions for Hands-On Lab
Written guide
 
In addition to the written guide and video guide, we also provide architectural diagrams to show you, in a visual format, what the end result looks like. If you’re a visual learner like I am, this can really help memorialize the concepts and solution.
 
Ansible Learn By Doing Architectural Diagram
Architectural Diagram
 

 

Complete the scenario and earn a new skill!

You now have access to the Hands-On Lab environment and the training resources you need in order to complete this lab, learn a new skill, and move on to more Ansible labs!
 
Here are some other Ansible Hands-On Labs, for example:
 
If you are part of a business account, your manager can see exactly which skills you’ve gained as a result of your training on Linux Academy, and that can go a very long way!
 
Enjoy, and happy learning! Don’t forget to refer a friend or connect your LinkedIn account in order to earn more Gems.
 

Start a 7-days free trial to get complete access to our platform and training content

Christophe Limpalair

Christophe L.

More about this author