Difficulty: Beginner
Estimated Time: 10 minutes

What is Ansible?

Ansible is a free software platform that allows you to configure and manage computer equipment , or that is how it is described in Wikipedia. In practice, Ansible does not serve only and exclusively for that, but also allows us to generate Docker images, upload / download artifacts from a repository and generate files that vary according to the execution thanks to the possibility of parameterizing templates.

For a developer this is very interesting , and it is very common to see Ansible as the engine to achieve Continuous Integration and Continuous Delivery in Software development teams.

Through this small course, it is intended to teach whoever is interested in using Ansible, in a totally interactive and guided way, in addition to proposing exercises to be carried out in their own environment with more than one machine and even remotely.

What will we learn in this small scenario?

The idea is to be clear about the base of the typical directory tree for an Ansible project . Knowing what each folder contains and what use it has within the hierarchy, in order to be able to find and solve errors in a more agile way, without losing much time in it.

We will create our own roles and understand how they work .

In addition, we can reuse our environment to extend the practice, through some ideas of exercises for you to practice.


Eventually, I will create more courses to talk more specifically about folders specific to Ansible roles or modules. The idea is that for now you can learn the base thanks to this small course, based on my experience with the tool.

The good thing is that Ansible has a fairly viable learning curve and probably with this course and a week of work + research on your own you are already a master, so ...

Courage and give it a go!

DevOps TF - Óscar Díaz Domínguez

Ansible 101 - Intro

Step 1 of 5

Preparing to use Ansible

For this course we will use a machine CentOS 7 , a distribution that is usually used to create production environments and that has a lot of documentation on how to solve all kinds of problems.

As we have a clean machine , without much more than what is strictly necessary to operate, we are going to have to install ourselves Ansible . The objective of doing this at this stage is to realize that Ansible is not only and exclusively that, but that it uses a series of dependencies that we will see below.

To install Ansible , we would have to use our package manager with the following command apt install ansible. in this case, it is already included in the environment.

What do we install together with Ansible?

If we execute the command, we will see how it solves the whole series of dependencies of the package, and before we write "and" and press Enter to install it, we can see that Ansible does not come alone .

In effect, Ansible uses Python to function . Besides this, you will also need to be able to establish SSH connections. In addition to the file structure, written in YAML, Ansible uses Python to create its various automation modules.

From modules for file control to package installation modules: everything (rather almost everything) running through python, without running natively on the machines where we call it.

Do you mean, then, that in all the machines that we want to automate with Ansible we will need to install all this?

The good thing is that the answer here is NO .

The master of Ansible and his Slaves

Ansible works with a structure in which a machine acts as a master or controlling node , while all others, generally, act as slaves of this master.

Best of all, Ansible ONLY has to be installed on the machine that acts as the controller.

To make the slaves work we simply need to have Python installed on them , since as we explained before, it is the part that is responsible for the execution.

With this ready, the teacher will be in charge of establishing the connections and delegate the different tasks to their nodes so that, through a very simple command, we can prepare a series of machines in a very short time, without being connected to us. directly and executing code natively.

With this ready and understood, we can begin with the creation and use of Ansible in our small testing environment.