16 septiembre, 2024

What is Ansible? How to get started in this DevOps tool

DevOps culture and cloud-based developments are becoming more important in the technology sector every day. Surely if you are in this world, you have asked yourself more than once: What is Ansible? and how to start using it? In this post we will tell you what this tool is and its potential for your projects.

what is ansible?

Do you know what ansible is?

Ansible is an automatic and remote configuration management software, which allows us allows you to centralize the configuration of numerous servers, network devices and Cloud Providers in a simple and automated way.

How to install Ansible?

Do you want to know how to use ansible?

Ansible is a very easy software to install, to do so, you only need a Ansible Controller running a UNIX-based operating system. Windows computers can also be managed, but the Controller must be Linux/UNIX.

To install it on Windows, you must run a Linux subsystem, although this is not generally recommended. Another option to install and run it is to do it through a Docker container.

Ansible Terms and Concepts

In addition to knowing what Ansible is, it is necessary to know a series of terms and their uses:

Inventories

Ansible generally works by executing tasks against different remote computers, network devices or APIs. The inventories, which can be set in Ansible INI, JSON or YAML format, They allow you to define said teams, group them and specify group or individual values ​​of these.

They are defined, by default, in /etc/ansible/hosts, but you can also establish a custom path with -i . Additionally, the path can be predefined in an Ansible configuration file: ansible.cfg.

Ad Hoc Commands

An Ad-Hoc command uses the /usr/bin/ ansible command-line tool to mechanize a single task on one or more managed nodes. These commands are quick and easy, but not reusable, they are used on the fly. Nonetheless, They are the first to be learned because they demonstrate the simplicity and power of Ansible; since the concepts learned will be transferred directly to the language of a playbook.

Some example commands are Ansible -m (for modules) or Ansible df h-.

$ansible [pattern] -m [module_name] -to «[module options]»

Playbooks

These are the Ansible configuration, deployment, and orchestration language. They can describe the configuration that you want managed computers to apply, or a set of phases in a general automation process.

At a primary level, Ansible playbooks can be used to guide configurations and deployments to remote teams.

Modules

They are also called task plugins or library plugins, and They are discrete units of code that can be used from the command line or in a Playbook task. These modules are developed in PowerShell for Windows and Python for Linux.

Variables

Some systems may require different configuration than others. In certain cases, the state of a system or observed behavior can influence the way other systems are configured. This is why Ansible uses variables, to help deal with inequalities between systems.

Conditionals

Often, the result of a playbook can depend on the value of a variable, a fact, or the result of a previous task. In some cases, variable values ​​may depend on each other, and additional groups can be created to manage hosts based on whether they match other criteria.

Loops

Sometimes, you want to repeat a task several times, to do this, Ansible loops include changing properties in several files and/or directories with modules (file module), creating multiple users (user module) and repeating of a probing step until a certain result is reached.

Loop and with_ are two words that Ansible offers to create loops.

Roles

They are ways to automatically load a file/directory structure, non-variable files, tasks and drivers based on a known file structure. Grouping by roles allows you to easily share these with other users in order to reuse codes.

Roles expect files to be in certain directories and must include at least one of these, although any that are not being used can be removed.

Ansible Galaxy

Included in Ansible, it is a free site to find, download, rate, and review all types of community-developed Ansible roles and may be the perfect way to jump-start your automation projects.

If, in addition to knowing what Ansible is, you want to bring all this knowledge to the code, here we leave you the practice we did in the webinar to discover the potential of this tool.

In short, what is Ansible? Ansible is one of the thousands of tools that are created every day to make the development of your projects easier. In the DevOps world, this and other technologies are essential to optimize, integrate and enhance your developments. Now that you know what Ansible is, the next step will be to master all these tools and methodologies, discover our DevOps & Cloud Computing Full Stack Bootcamp. In less than six months you will become a crack at this new trend in programming, download the bootcamp syllabus here.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *