With the constant advance of new technologies, companies increasingly need to become aware to the new and especially to the practical at low cost.
In addition, we must think about the following current challenges:
- Heterogeneous architectures such as networks, Operating Systems, and implementation and/or development by different specialists
- Systems security, integrity, availability, reliability, and control of personal data handling
- System scalability, resource cost control, resource depletion, loss of performance, and prediction of possible system difficulties
- Error handling, alarming, backups, and high availability
- Transparency of the system, access, location, concurrency, replication, failures, mobility, performance, and scalability
Ansible is a very favorable tool for this, performing everything in a simple, fast, and easy way, turning your challenge into an efficient solution.
To start, let’s talk about what Ansible is: it is an open source tool created by Michael Dehaan (Red Hat) used to automate tasks that are usually done manually.
Its advantage is that from a central location, we can distribute to multiple sites without the need for client software. It is fast to deliver, the automation in some cases is ready on the manufacturer’s website, the fine tuning for customization of the environment is easy, and the management is very simple.
Some examples of what we can do are management for specific hosts or network environments, automation of tasks that are performed repeatedly and with great frequency, orchestration for several machines, administration of some functions such as, creation with the proper permissions, users, groups, directories, file systems, among other activities.
It is your imagination that will limit what you can do!
Ansible’s engine has 4 important items, Inventory, Module, API, Plugins.
These four items will not always be used, but they will always be present and available.
In the Ansible structure we have:
Inventory: File containing information about the servers that will be configured
Task: It is a specific task that will be executed
Play: It is a set of tasks for a certain purpose
Playbook: It is a file in YAML format containing a series of procedures, and these procedures are:
- Module: a module typically abstracts away a system task, such as dealing with packages or creating and changing files. Ansible has many built-in modules, but you can also create custom modules.
- Role: a set of playbooks, in an organized way for the purpose of being reused
An example of what Ansible’s content infrastructure looks like:
In a common scenario, we have an administrator or more administrators, who need to install, configure, manage, tune, deploys, updates on the servers they manage. These tasks are written in a playbook (something customized), or we can use something ready-made on the Ansible site or from the manufacturer of the product we are working on. The playbook is interpreted by the engine (Ansible engine) and will be distributed to a group of hosts or to the network.
I share some checks that have worked for me, and that may be useful for those who work or will work with Ansible:
- Backup of original configuration files
- Connectivity between servers
- Check file/ansible/hosts
- Properly configure the inventory file
- If you change ssh key check the files folders
- Have the variables file configured according to your needs
- Test the playbook