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.
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
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:
- Edit /etc/hosts to include the following entry:
ansible.xyzcorp.com 169.168.0.1
- Install elinks
- Create the user xyzcorp_audit
- 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
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.
Video guide
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.
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!