Watch Overview of Ansible Learning Path here, which is just one part of a full DevOps Bootcamp
☝️ What is Ansible and Why to Learn it?
Ansible is one of the most popular configuration management tools currently used in IT projects. Having Ansible knowledge is extremely valuable for a DevOps or Cloud engineer.
But learning Ansible can be quite challenging. 🤯
So this article should help you learn Ansible with the following 4 steps:
✅ Understand what is the purpose of Ansible
So what is Ansible?
It's a tool that helps you automate different IT tasks. Now what are those IT tasks and why is it important to automate them rather than doing them manually? 🤔
For that to understand, let's check out some use cases of Ansible.
💡 Ansible Use Cases
Let's consider, your company has 50 servers, where your dockerized applications are running 🐳
Docker releases a new version and you want to upgrade Docker to this latest version on all 50 servers. This kind of upgrades may involve many steps, like restarting some processes, reconfiguring the environment etc.
Now imagine, if you had to manually do this update. You would have to manually ssh into the first server, do the configuration there, maybe execute a shell script you have prepared. Then ssh into the next server, do the same configuration there etc 👩🏻💻 And repeat this for each of the 50 servers:
And now imagine, if you had to do this manually on all 50 servers, every time you want to make some configuration change. Maybe you want to create new Linux users on those servers, or install up-to-date OS packages, apply some security patch because of a security issue, or do backups 🤦🏽♂️
Plus, when doing those changes manually, it's hard to remember every change you have made so far. So if 5 of those servers crashed, how can you restore the exact same configuration on the new servers? 🫣
That's where a configuration management tool, like Ansible comes to rescue 🙌
It makes this manual process of server management efficient by automating it.
And it does it using 3 important elements:
✅ You can write all the configuration steps in a single YAML file ("Configuration as Code") instead of manual tasks and various shell scripts
✅ You can execute all the tasks defined in this YAML file on the servers remotely from your own machine, instead of ssh-ing into each server one-by-one
✅ You can execute this YAML document on all servers at once, by simply passing it a list of server IP addresses as a parameter. So whether you have 5 servers or 500 servers, it's 1 simple Ansible command to execute configuration changes on all those machines 🥲
Having such an automation makes server changes more reliable, since you can avoid any human error, like forgetting to configure one of the servers, or forgetting to execute a specific command on 1 server.
And in case, you lose few servers, you can very quickly and easily restore the configuration on brand new servers.
🚀 5 Hands-On Projects to Learn Ansible
Now that you understand why automated server configuration management is so important and how Ansible can help you manage your servers efficiently, let's see 5 real life projects that will help you master Ansible 👍
These are just snippets from our
complete DevOps bootcamp projects list 📋
You can download the full project list of all DevOps technologies we cover in the bootcamp here: DOWNLOAD DEMO PROJECTS ⬇️
Ansible Demo Project 1
Write Ansible Playbook that configures a Linux server on a cloud platform to prepare the application deployment environment.
Then builds and deploys a Node.js application to the configured server.
Ansible Demo Project 2
Provision an EC2 instance with Terraform.
Write Ansible Playbook that connects to the newly provisioned server and installs Docker and Docker Compose on it.
It then copies a docker-compose file to the server and start the Docker containers configured inside the compose file.
Ansible Demo Project 3
Provision an EKS cluster using Terraform.
Write Ansible Playbook to create a new K8s namespace and deploy an application inside that K8s cluster namespace.
Ansible Demo Project 4
Provision few EC2 instances with Terraform.
Write Ansible AWS EC2 Plugin to fetch the IP addresses of the newly provisioned EC2 servers and dynamically set them in Ansible inventory, instead of manually hard-coding the server IP addresses.
Ansible Demo Project 5 - Capstone Project
Steps of this demo project:
Create a dedicated server as Ansible Control Node.
Write Ansible playbook to configure multiple EC2 instances.
Create a Jenkins pipeline job to trigger executing Ansible playbook on a remote Ansible Control Node to configure EC2 instances.
This project involves many complex steps and mirrors a real-life configuration of Ansible automation from a CI/CD pipeline.
By learning those details and important nuances, of what gets executed where and how to configure every step of the integration between servers and tools is where the real knowledge comes from 💡
This is where you learn the most 👏
And we go through this setup in detail, understanding every touch point and every configuration step, from setting up the CI/CD pipeline to connecting to servers to executing the Ansible playbooks, in the Ansible course within the DevOps Bootcamp.
We don't skip any details, to make following the steps to build even such a complex project, super easy and intuitive ✅
📚 Learning Roadmap - How to Learn Ansible
These are just few of the projects that you learn to build in the Ansible course within our DevOps bootcamp.
We cover Ansible, it's core components, Ansible architecture and 8 real-life projects in the Ansible module, so you become an absolute pro in using Ansible for any type of IT automation job 🥷
This skillset will undoubtedly make you a much more valuable engineer, no matter what your engineer role may be 💎
So this are the concepts and use cases you learn in our Ansible course within the DevOps bootcamp:
📗 We start by covering all the Ansible Core Concepts, such as Ansible Inventory, Ansible Ad-hoc commands, How to write an Ansible Playbook.
📗 After that we move on to using Ansible modules for various use cases, such as installing packages and tools on a server, configuring applications, working with a file system, moving static files between machines etc.
📗 In many demos, you will learn how to map and translate standard shell scripts and commands into Ansible playbooks to automate various common tasks
📗 You will also learn how to configure servers with different Linux distributions, so you learn the common concepts, and work with any OS distribution and write more flexible Ansible playbooks, rather than being limited to 1 specific OS
📗 In this context you will also learn how to use Ansible variables to make your Ansible playbooks customizable and also see all the different ways of setting the variable values in Ansible
📗 While writing and executing those Ansible playbooks, we will also learn how to troubleshoot results and use conditionals and privilege escalation when needed
📗 And we will also learn about Ansible Collection and Ansible Galaxy
After that we will dive into more advanced topics of Ansible:
📕 We will configure Ansible dynamic inventory for dynamically getting the AWS EC2 server addresses from AWS instead of statically hard-coding them. This is an extremely important concept when working a large dynamic infrastructure
📕 You will also learn how to execute Ansible playbooks from a Terraform script, directly after provisioning a new infrastructure, which will teach you how to completely automate provisioning and configuring infrastructure
📕 In addition, we will use various Docker modules from Ansible, to work with docker images and containers, and use docker-compose module to deploy dockerized application on a server automatically
📕 We will also use Kubernetes module from Ansible to automate configuring the cluster and deploying Kubernetes components in it
📕 In another more advanced demo project, we will integrate Ansible in a Jenkins CI/CD pipeline to automate application deployment with a production grade setup
📕 In the final demo project, you will learn how to make your Ansible content more re-usable and modular with Ansible roles. So you will know how to write more maintainable Ansible code for more complex Ansible projects
Finally, as part of the configuration as code concept, we will host our Ansible project in a Git repo and add playbooks for all the demo projects there.
So by the end of the module, you will end up with a nice Ansible project portfolio 💼
Use Ansible in combination with other DevOps Technologies
So as you see, you don't learn Ansible just as a standalone tool in this Ansible course, but rather integrated with different technologies, like Docker, K8s, Terraform, Jenkins, AWS and so on, in various real world use cases.
As the Ansible module builds on the previous modules in the DevOps Bootcamp.
This is the most important and valuable element of our programs, that we teach every DevOps tool with real life integrations with other technologies and platforms, which you almost never find in other educational programs 🤷🏻♀️
I hope to help you on your journey of becoming an absolutely pro in Ansible, and thus not only advance your engineering career, but also make your engineering work much more efficient and productive 😊
You can find the entire program information for DevOps bootcamp here: 6-month to work as a DevOps Engineer
See you on the inside 👋👩🏻💻