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.