Ansible for Beginners

Ansible is currently the most popular automation and configuration management tool on the market used for DevOps. Our Ansible for beginners tutorial will help you learn all about this IT engine that automates the following tasks:

  • Orchestration

    Integrating multiple applications and executing them in a specific order. For example, if you consider a webpage that you are hosting, the page stores all the values it collects users in a database. The first thing you must do is ensure that the system has a database manager, and only then do you host your webpage. This kind of order is essential to ensure that things work right.
  • Configuration Management

    This means that all the systems are maintained at a consistent desired state. Other tools that automate configuration management include Puppet and Chef
  • Deployment

    Ansible will also automatically deploy applications onto servers with different environments. It can also ensure that these applications and the code are deployed at a particular time or after regular intervals.

Now that you know what Ansible is used for, let’s jump straight into an Ansible for beginners tutorial that will help you learn the basics about the technology..  

Why Should You Use Ansible?

Let’s say a system administrator is responsible for a particular company's extensive infrastructure, which consists of all of its systems. This could include web servers, database servers, various repositories, and so on. As a system administrator, it’s crucial to ensure all systems are running updated software versions. Because of the size of a company’s infrastructure, it can be difficult for one individual to take care of a task of this magnitude manually. Not only can it quickly become mundane, but manual work such as this is prone to errors. These inefficiencies also stifle innovation. 

Earn the Most Coveted DevOps Certification!

DevOps Engineer Masters ProgramExplore Program
Earn the Most Coveted DevOps Certification!

What’s the Solution?

With Ansible, a system administrator can write simple codes that are deployed to all systems, and they can be configured to the correct states.

Now let’s learn about Ansible Architecture in this Ansible for beginners tutorial.

Ansible Architecture

Ansible has two main components: the local machine and the node, also known as the client machine. 

The local machine is where the system administrator sits. He or she installs Ansible here, and on the other end, you have your node. With Ansible, there is no supporting software installed on the node. These are just the systems that need configuration. The local machine completely controls them.

The local machine communicates with the client through SSH, a secure shell that provides protected communications. With your local machine, you also have a module, which is a collection of your configuration files, also known as playbooks. Playbooks are written in YAML (Yet Another Markup Language), which is super easy to understand and learn since it’s so close to English. 

Then, there is the inventory, which is a file that contains all the nodes that require configuration. These are grouped based on the kind of configuration they need. 

Let’s now dive into how Ansible works in this next part of the Ansible for beginners tutorial.

Learn Concepts - Basics to Advanced!

Caltech Program in DevOpsExplore Program
Learn Concepts - Basics to Advanced!

How Does Ansible Work? 

You have your local machine on one end, which is where you install Ansible. It’s also agentless, which means you're installing Ansible only on the local machine with no supporting software or plug-ins being installed on the client. This means that the local machine has complete control over the environment.

Another critical term that is associated with Ansible is “push configuration.” Because the local machine has complete control, it “pushed the playbooks out to the nodes, hence the term. The playbooks and the inventory are written at the local machine, which then connects with the nodes through the SSH client.

The following visual illustrates this process:

ansible tutorial

Although this step is optional, it's always recommended to do so — collecting facts. Facts are data points about the current state of the node. Once the facts are received from the node, it is sent to the local machine. When the playbook executes, the task mentioned in the playbook is compared to the current stage of the node. Only the changes that are required to be made further are made, and once the playbooks are executed, your nodes are configured to the desired states.

Let’s take a look at the benefits of Ansible in the next section of the Ansible for beginners tutorial.

Learn Concepts - Basics to Advanced!

Caltech Program in DevOpsExplore Program
Learn Concepts - Basics to Advanced!

Benefits of Ansible

Ansible is currently the most trending tool in the market under the configuration management umbrella. There are various benefits of Ansible, including:

  • Agentless

    No additional software or plugins need to be installed on the client’s systems. This creates efficiency because there is more space on the nodes for other resources. 
  • Flexible

    Infrastructure is prone to frequent changes, and Ansible doesn’t take any time to adjust to these changes. 
  • Simple

    Because playbooks are written in YAML, which is as close to English as you can get, Ansible is super easy to write and use. 
  • Automated Reporting

    The playbook has several tasks, which are all named. When you run a playbook, a report is generated that shows which tasks ran successfully, which failed, which clients were not reachable, and so on. This information is crucial when you are dealing with extensive infrastructure.

Let’s take a look at the benefits of Ansible in the next section of the Ansible for beginners tutorial.

Check out the Ansible Foundation Training Course that helps you configure network devices across Linux or Windows operating systems.

Learn More About Ansible and Get Certified

At Simplilearn, we offer an array of online education programs to help prepare you for exams to get certified. If this Ansible for beginners tutorial intrigues your interest, and you wish to get an in-depth understanding of Ansible, we highly encourage you to enroll in our Ansible Foundation Training Course. We also offer a DevOps Certification Training Course that teaches a variety of skills, including Ansible. Learn something new today and prepare your career for a better tomorrow!

About the Author

Sana AfreenSana Afreen

Sana Afreen is a Senior Research Analyst at Simplilearn and works on several latest technologies. She holds a degree in B. Tech Computer Science. She has also achieved certification in Advanced SEO. Sana likes to explore new places for their cultures, traditions, and cuisines.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.