What is Ansible? A Beginner's Guide

What is Ansible? A Beginner's Guide

Why Ansible?

Ansible is a code that we can use to write and describe the installation and setup of all of your servers and you can actually repeat it and deploy those servers consistently into multiple areas.

What is Ansible?

Basically, Ansible is a configuration management tool used to configure multiple computers/servers at the same time without manual inputs to each one of them

It is Push-based configuration tool thereby eliminating the need to install each server and thus agentless another good feature is a configuration in YAML which is very easy to write and understand. It is mainly used for

  1. IT automation: To automate the IT setup that you would typically do manually.

  2. Configuration management: Used to maintain all the system infrastructure.

  3. Automatic Deployment: Applications are deployed automatically in various environments.

Ansible- Push configuration Tool

Screenshot 2022-09-09 at 12.49.10 PM.png

**Pull configuration **(Polka configuration): Nodes are checked with the servers periodically and fetch the configurations from them.

Push Configuration: Servers pushed configurations to the nodes respectively. Ansible and chef, puppet both have push configuration but in chef and puppet there is master-slave architecture with a master server connecting with a client on a remote slave environment, where we can push out the updates but in Ansible we are pushing out the service and structure of the server to the remote hardware and we are just putting it on hardware irrelevant of the structure.

Ansible Architecture

Let us understand the below show Architecture of Ansible:

Screenshot 2022-09-09 at 12.01.07 PM.png

Local Machine: Local Machine is where Ansible is Installed.

Module: The module is a collection of configuration code files.

Inventory: Inventory is a document that groups the nodes under specific labels.

Nodes: Nodes are the system to be configured. They are controlled by the local machine.

The Local machine connect to the nodes through an SSH client.

Playbook

Screenshot 2022-09-09 at 11.53.28 AM.png

The core of Ansible is Playbook.

  • Playbooks are the instructions to configure the nodes.

  • They are written in YAML( YAML ain't markup language) used to describe data.

Inventory

Screenshot 2022-09-09 at 11.54.04 AM.png

An Inventory file classifies nodes into groups and is used to maintain the structure of our network environment.

Working on Ansible

Screenshot 2022-09-09 at 11.54.21 AM.png

Ansible is installed only on the Local machine and it connects to different nodes within your network. This makes ansible Agentless. On the local machine, we firstly have a Playbook which is a set of instructions for how to set up the remote nodes and then to identify how to connect to those nodes so we have Inventory where we use a secure SSH connection to each of the servers so that we are encrypting the communication to those servers and we're able to grab basic facts on each of the server so we understand how we can push out the playbook to each server ad configures that server remotely. The end goal is to have an environment that is consistent.

Ansible Tower

  • Ansible Tower is a Framework for Ansible created by Redhat.

  • It provides a GUI, thus reducing the dependency on the command prompt window.

  • Instead of typing long commands, tasks can now be performed in a single Click with the help of Ansible Tower.

Benefits of Using Ansible :

  1. Simple: As we’ve seen, Ansible uses a very simple syntax written in YAML known as playbooks — YAML (Yet Another Markup Language) is a human-readable data serialization language. We don’t need special coding skills to code and understand playbooks. It is very easy to install and execute tasks in order

  2. Agentless: As long as a connection can be SSHed and it has Python, it can be configured with Ansible; No agent/software or additional firewall ports are required to install on our client or host systems for automation. Also, we don’t have to worry about setting up and managing the infrastructure.

  3. Powerful and flexible: Having powerful features gives us the capability to model even complex IT workflows in lesser time, along with managing infrastructure, networks, operating systems, and services that are already in use.

  4. Modular: Ansible is modular as we require only one program per script. This way, we can spread our programs across different servers.

  5. Efficient: Not requiring any extra software on our servers means that there is more space for our resources.

Use Case by HootSuite

1606883577630.png

Hootsuite is a social media management system used by businesses and organizations. It allows the execution of social media campaigns on a variety of networks from a secure dashboard. Hootsuite is popular among Fortune 1000 companies.

The main challenge facing Hootsuite was the lack of repeatability. This made automating Hootsuite’s infrastructure a challenge, and Hootsuite were also facing difficulties in application deployment.

To resolve this, Hootsuite introduced Ansible core. This allowed Hootsuite to build servers from scratch and enabled repeatability. In the future, Hootsuite plans to implement an Ansible migration of its app deployment and possibly in ad hoc production server management.

Since performing their Ansible migration, Hootsuite says ops and devs ‘feel safer’. Additionally, Ansible allows developers to repeatedly test server builds on a local level until the team can be sure they work.

Hootsuite intends to use Ansible in many other ways, and as Beier Cai, Director of Technology, Hootsuite Media Inc., explains, “In the beginning I didn’t realize Ansible is good for orchestration as well but found it out quickly and I really loved it as it beats competitors right there.”

Want to Know more refer to the Video: What is Ansible

Pic Credits: Simplilearn

That's all for now. Please like, share, and comment if you found this information informative. If you have any questions, please leave them in the comments section and I will do my best to answer them. Thanks for reading. Any feedbacks are welcome!! :) Connect me on Twitter | Linkedin | Github