This Article will give you an Idea that how advancement and Automation made the Configuration of System an easy task. Here we will talk about “Automation Using Ansible”, and How Trivago, an international Hotel and Travelling Agency using Ansible to get Automated Operability and Availability of Service with lower latency with best deals to the customers.

Automation is there in the world of IT from decades but Ansible is mainly designed for “Configuration Management”, the tool come to market with High Scalability and ability to kick Start the business, without giving high wages to employees and just Making Scripts to keep on configuring each node started by the Load Balancers.

Now the question arises what all Ansible is providing as automation, Can we rely on it for all the Steps of Configuration Management ?

The answer is Straight forward but let’s understand by the features of Ansible :-

1️⃣ Configuration Management :

Ansible used to centralized the Configuration using file management for the common steps used for configuring a particular Software inside a System. Only we need to declare the Steps / Tasks inside a file that is further run to deploy the instructions on a particular or a group of System.

2️⃣ Application Deployment :

From development to Production all the life cycle could be achieved and managed efficiently using Ansible. Just one need to define their set of Application in Ansible then the deployment is done with “Ansible Tower”.

3️⃣ Provisioning :

Application can be deployed or installed on system using Ansible. Even the Red Hat Ansible tower helps in the process of Provisioning System, Either you have to start the bare metal or virtual machine or an instance over cloud.

4️⃣ Continuous Delivery:

Ansible Playbook keep the application deployment proper and manage throughout the entire life Cycle, even can be use in Sage Maker.

5️⃣ Security and Compliance:

Scanning and Remediation of site wide security policies can be integrated into other automated processes. The security policies must be defined inside the Ansible Playbook to be deployed on the Target / Managed System.

6️⃣ Orchestration :

The interaction of multiple configured system must be defined, here I mean the link between different set of Tasks to be performed to completely install or configure an Application. Example: If an apache web server is been configured inside target nodes then the steps performed one after the other must be integrated and have to move serially.

7️⃣ Idempotence Nature:

If a mentioned Task in Ansible Playbook is done already then to save the resources Ansible has various modules which are idempotent in nature. For managing the Idempotence behavior with other modules ansible has a concept named “Handler”.

8️⃣ Replication :

Configuration management makes it easy to replicate environments with the exact same software and configurations. This enables you to effectively build a multistage ecosystem, with production, development, and testing servers.

9️⃣ Abstraction :

Ansible works on RAL concept i.e Resource Abstraction Layer. The modules and Ansible Architecture itself is built to support this. It uses concept of IAS i.e Infrastructure as Code. Which will work on all the Types of Operation System with any kind of version.

Concluding all the Above features we can Now say that :

“ Ansible is an Open Source automation Platform. It is a simple automation language that can perfectly described as IT application infrastructure in Ansible Playbook. It is also an automation engine that runs Ansible Playbooks.

Ansible can manage powerful automation tasks and can adapt to many different workflows and environment.”

Some Other Facts about Ansible:

Ansible Playbooks are human readable automation code that perfectly describe an IT application infrastructure Configuration.

✔ Ansible is Agentless: i.e. it connect to hosts to manage the configuration/provisioning/monitoring using protocols Like OpenSSH or WinRM to run a set of task. Only the host need to have the Specified Modules which internally append with Ansible code (playbook) and achieve the required tasks.

✔ Agentless Architecture and work on Push Mechanism. Administrator can use Ansible playbook / Ad Hoc Commands

✔ Playbooks are designed to be idempotent. To run Arbitrary commands we have multiple modules available

✔ Ansible is framed on Python Language. Founder/Developer of Ansible: Michael Dehaan

✔ Ansible is a part of DevOps Tool Stack Kit which is used for Configuration management. Ansible could be defined as “Language of DevOps” which helps Operation team and even development team to configure the setup for Testing or Production at any point of time by simply running a playbook with Static or dynamic inventory support.

✔ The perfect description of application could be done by Ansible Playbook with all the aspects of application environment can be described and documented. Ansible Playbooks are just a plaintext files that runs regardless of the location of the infrastructure. These Playbooks are written in YAML format in text files.

✔ The Ansible Architecture is agentless which is most suited to get the application deployed of the configured environment and get “FAST TO MARKET” which is the only goal of this tool.

Let’s Discuss the Architecture of Ansible :

There are two types of Machines in Ansible Architecture :-

◼ Control nodes : Ansible is installed and run from this node. This machine also contain the copies of Ansible project files. This node could be Administrators’ laptop or a system shared by a number of administrator, or a server running Red Hat Ansible Tower.

◼ Managed Hosts : These nodes are mentioned in Inventory Files. These inventory organize those target systems into groups for easier collective management.

Inventory Files are defined in a static text file, or dynamically determined by scripts that get information from external sources.

Each Task run a module, a small piece of code (written in Python, PowerShell, or some other language), with specific arguments. Each module is essentially a tool in your toolkits. Ansible ships with hundreds of useful modules that can perform a wide variety of automation tasks.

Ansible uses Plug-ins. Plug-ins are code that you can add to Ansible to extend it and adapt it to new uses and platforms.

Ansible Architecture is agentless. The Controller node connect to the managed host using SSH or WinRM. Ansible works on Push mechanism.

Ansible playbooks are written including the modules in declarative language i.e. YAML or JSON. Playbook contain various plays that include tasks to manage and configure a Single or group of Managed Nodes.

We Can create Static inventory or Dynamic inventory for list of Managed Hosts. Dynamic Files are useful in Scaling Hosts for Traffic management by Load Balancers to configure same environment using Ansible Plays.

About Trivago :

Trivago is the world’s largest hotel search! Trivago compares prices from over 700,000 hotels on over 175 booking sites so users can find their ideal hotel.

The Above Line about Trivago is best introduction that we usually listen at Television Adds. The company have served their customers best, and have reached the top search application for Travelers across globe.

Trivago was conceptualized in 2005 in Düsseldorf, Germany by 3 university friends: Rolf Schrömgens, Peter Vinnemeier and Stephan Stubner. Like most start-ups, the site’s first iteration was deployed from a garage. In 2006 Stephan decided to become a professor, so Malte Siewert joined the founding team. Today, our leadership team consists of CEO Axel Hefer, CFO Matthias Tillmann, CTPO James Carter and CPO Anja Honnefelder.

Company’s Growth Scale

Behind the seen Trivago is using A stack of Technology for faster results with Zero downtime. Ansible is also contributing as one of the Technology for robust results. As we know that Ansible is capable of providing :

🔅 Configuration Management

🔅 Application Deployment

🔅 Provisioning

🔅 Continuous Delivery

🔅 Security and Compliance

🔅 Orchestration

👨🏻‍💻 Ansible is used for Server Configuration at Trivago. 👨🏻‍💻

Let us see how they are Using Ansible behind the seen to configure their Web Servers and other Database Servers by the following Experiment, where we will configure a Managed Node with Apache Webserver and then deploy a simple webpage over it.

Let’s Install Ansible:

As Ansible is a python module so can install using pip command

pip install ansible

Then have to create configuration file ansible.cfg and inventory file i.txt:

Ansible configuration file is there but have to do configuration

ansible.cfg

Will Create a Static Inventory file named “myhosts.txt”, you can name anything to this file. This a normal text file whose path is given in config file.

myhosts.txt

Now after this check from version command of Ansible.

ansible -— version

ansible version

Here you can see the config file is placed where we have path of our inventory file and everything is stable. Now lets create a playbook :

ansible playbook for Webserver Configuration

Understanding each line of playbook is easy if you know what are the steps have to perform while configuring webserver. Here in YAML file just written the steps using respective modules of ansible.

hosts keyword used at topmost line declare the Managed node or group of managed nodes on whom have to perform a set of task, written under Tasks keyword.

Following are the module names used in the play and their description:

❄ package module: Installs, upgrade, removes, and lists packages and groups with the dnf package manager

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/package_module.html

❄ copy module: Copies a file from the local or remote machine to a location on the remote machine

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html

❄ service module: Controls services on remote hosts. Used to start , stop or restart service.

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html

Let check ping between both the Controller and Managed node using “Ping” module in Ansible:

ping successful between Controller and Managed Node

Now on running this ansible playbook, using command :

ansible-playbook <filename>.yml

running the ansible playbook

Now service started working over our managed node, we can check by going to that managed node:

httpd service is actively running

Lets check the webpage that we have launched over this server:

Website is running fine

So like this, Trivago is also managing the Server Configuration using Ansible.

Hope this article helped you for knowing the basic of ansible and how Trivago is using Ansible. To know more about ansible visit : https://docs.ansible.com/

Technology enhancement take a journey of learning and exploring!! On a way to achieve and Follow my own star!!