Skip to main content

Command Palette

Search for a command to run...

Introduction to Ansible

Where it is Being Used in the Industry?

Published
4 min read
Introduction to Ansible

What is Ansible?

Ansible is a simple yet powerful IT automation tool that is used for Operational DevOps which helps in automation and maintenance of the server. It is open-source software whose original author is Michael DeHaan and is being improved by the contributions of thousands of members of the Ansible community. It was acquired by Red Hat in 2015.

Ansible is a tool that provides:

  1. IT Automation: Instructions are written to automate the IT professional's work

  2. Configuration Management: Consistency of all systems in the infrastructure is maintained.

  3. Automatic Deployment: Applications are deployed automatically on a variety of environments. This includes updating applications and downloading software or multiple systems.

Ansible does all the repetitive tasks which the System Administrator would have to do manually by logging on to each system. Using Ansible save the System Administrator a great deal of time

Why Ansible?

Ansible is used in the industry because it is efficient in performing tasks and less time-consuming in 4 ways:

· It executes the tasks from our machine remotely instead of going on each server one by one.

· Configuration/Installation/Deployment steps are written in a single YAML file instead of manual and shell scripts

· We can reuse the same file multiple times and for different environments.

· It is more reliable and less likely prone to error while used in configuration systems and deployment of applications.

Some Important Ansible Terms

  1. Module: Collection of configuration files, basically small programs that work. They are sent from the host machine to the target machine and after doing their work they are deleted. They only do small specific tasks.

2. Playbook: Sequential tasks are grouped in modules that have arguments and descriptions of a task from an Ansible Playbook. It is also a collection of one or more plays (tasks that are described along with the user).

3. Inventory: It is the main network structure where machines are involved in the task execution. The machines can be identified by using their IP addresses or hostname.

No alt text provided for this image

Ansible Usage in Different Fields

  1. Application Deployment

Ansible is one of the simplest ways to deploy our applications on various target machines simultaneously without any hassle. We can deploy the application on the systems from one common framework. Since Ansible is a push-type configure the server will push the required configuration to the nodes irrespective of the hardware configuration of the target system.

One need not write custom code for deployment but simply list the task to be performed in the playbook. All this communicable is secure as Ansible uses SSH keys to communicate the local system with the remote host to run the required task.

  1. Configuration Management

Ansible is very simple and reliable for configuration management. It requires only an SSH key to start managing systems and can start managing them without installing any software. This can be illustrated in the manner if we want to install an updated version of some software on all systems in a division, the System Administrator requires only to write the IP Addresses of the nodes in the Ansible Playbook to install it on all the nodes, which can be run from the host system.

3. Security and Compliance

As with any application deployment, security policies can be implemented along with other automated processes. If we configure the security details on the host system and run the associated playbook, all remote hosts will be updated with that security meaning it is not required to monitor every system’s security continuously. Also, the user credentials are not retrievable in plain text by any user in Ansible making it safe from attacks.

4. Orchestration

Using the Ansible Playbook we can write tasks that help us to orchestrate the execution of our module/environment. To deploy applications we need to define how multiple configurations will interact as a whole. Ansible allows the creation of an infrastructure that can be scaled to the needs of each application. It aligns the levels of overflow.

  1. Using Docker

Ansible supports and allows provisions for all infrastructure from OS to Cloud Services. By using Ansible Playbooks we can create a Docker container, cloud instance and bare metal servers. It allows us to reproduce the app across environments that are not in the Docker container. We can manage the host where the Docker container is running so we can execute tasks both in the host and the Docker container.