ANSIBLE USE CASES AND CASE STUDY:-

What is Ansible??

Because Ansible is all about automation, it requires instructions to accomplish each job. With everything written down in simple script form, it’s easy to do version control. The practical result of this is a major contribution to the “infrastructure as code” movement in IT: the idea that the maintenance of server and client infrastructure can and should be treated the same as software development, with repositories of self-documenting, proven, and executable solutions capable of running an organization regardless of staff changes.

How Ansible works??

Ansible works by connecting to nodes (clients, servers, or whatever you’re configuring) on a network, and then sending a small program called an Ansible module to that node. Ansible executes these modules over SSH and removes them when finished. The only requirement for this interaction is that your Ansible control node has login access to the managed nodes. SSH keys are the most common way to provide access, but other forms of authentication are also supported.

Configuration Management Tools:-

There are multiple configuration management systems. The most popular are for Unix-based systems and include Ansible, Chef, Puppet, Saltstack, CFEngine.

All of them have pros and cons, but there is also a common trait they share — this is a new approach in the field of system administration. This new paradigm is called infrastructure as code. Before its creation, the process was as follows. Servers were set up, brought online, and then configured using various scripts to ease and automate many tasks. In most cases, this was required for every individual server. With this new approach, a configuration is created once and shared across many servers.

What Can Ansible Do??

  • OS (de)installation
  • OS configuration
  • creation and removal of users
  • management of users’ passwords and keys
  • creation and removal of virtual environments and containers
  • deployment of code
  • running scripts and tests, etc.

This is a short list of tasks that can be accomplished using Ansible, but the full range of options is much more comprehensive and only limited by the imagination.

Key Features of Ansible:-

  • Idempotent — same operations provide the same result as many times as they are carried out;
  • Easy and expandable — Ansible is written in Python and uses YAML to write the commands, and both languages are used to teach the beginners as they are considered to be easy to learn.

We are going to take a simple path while studying Ansible, which will include examples and their explanations. However, it’s preferable to know what a programming language, variable, cycle, and vocabulary used will be. Also, a basic knowledge of YAML structures and simple Unix commands would be useful. For all interactions, we are going to be using the client installed on Ubuntu 18.04, and on a server with Ubuntu 18.04 installed on it.

Ansible Playbooks

Playbooks define variables, configurations, deployment steps, assign roles, perform multiple tasks. For E.g. COPY / DELETE Files and Folders, install packages, start services. So primarily playbooks are defined to orchestrate the steps to multiple machines or servers and get them all to a certain desired state.

Playbook is written in YAML format with a .yml file extension. One needs to be very careful with the format and alignment which makes it very sensitive.

It contains the following sections:-

  1. Every playbook starts with 3 hyphens ‘ — ‘
  2. Host section — Defines the target machines on which the playbook should run. This is based on the Ansible inventory file.
  3. Variable section — This is optional and can declare all the variables needed in the playbook. We will look at some examples as well.
  4. Tasks section — This section lists out all the tasks that should be executed on the target machine. It specifies the use of Modules. Every task has a name which is a small description of what the task will do and will be listed while the playbook is run.

Ansible Modules:-

  • raw — allows us to run commands on the remote host even if Python is not installed on it, also the command is sent as it is and not checked by Ansible whether the syntax is correct.
  • command — a command is run directly past the shell installed for the user.
  • shell — the command is executed using shell mentioned in the /etc/passwd file for the user, which is used by Ansible for the session (usually /bin/sh or /bin/bash).

Ansible Case Study

Raun proceeded to use Ansible up through the present, a span of two years. He used the system for a variety of platforms and stacks such as web applications, user management, secure virtual private server hosting configurations, and tracking.

He also used Ansible to access cloud services and for any projects needing repetition on a stable foundation.

For applications, you can automate building, testing, and code deployment to any environment in your infrastructure with auditing and reporting for the entire process. This allows you to eliminate manual image building and script execution and focus on innovation. In addition, Ansible easily integrates with the majority of existing version control systems and many other tools right out of the box.

Use Cases for Modernizing and Automating Workflows:-

Managing an organization’s many tools and business processes is becoming increasingly complicated as technology expands. Whether your teams are performing their weekly system reboot, or looking to configure instances to a desired state, it’s no secret that automation is critical to increase speed, efficiency, productivity, and accuracy. Listed below are several instances1 where automation can help across your enterprise.

  • Weekly system reboot: There’s nothing worse than doing the same thing for 8 hours a day .Eliminate repetitive, manual processes with automation.
  • Enforce security guidelines: Rules are rules. It’s best to automate in an effort to achieve strict security standards.
  • Monitor configuration drift: Use check mode with Ansible tasks to enforce desired settings and see if your configuration has drifted.
  • Disaster recovery: Disaster recovery can involve a wide range of components. Act across different variables of the technology stack to identify problems and eliminate cross team dependencies.
  • Command blaster: Remarkably easy to write, you can run commands across your environment for any number of servers.
  • Database binary patching: Several databases use outdated binary sets. Patch the binaries in accordance with the release of the latest patch.
  • Instance provisioning: Use modules for several cloud providers to create new instances and tailor their configuration.
  • Service license agreements: Mistakes cost time and money. Eliminate errors that can crop up in detailed software contracts.

Ansible’s Features and Capabilities:-

1. Configuration Management

2. Application Deployment

3. Orchestration

4. Security and Compliance

5. Cloud Provisioning

Next in our learning of what is Ansible, let us learn the Ansible architecture.

Advantages of Ansible:-

  • Very simple to set up and use: No special coding skills are necessary to use Ansible’s playbooks (more on playbooks later).
  • Powerful: Ansible lets you model even highly complex IT workflows.
  • Flexible: You can orchestrate the entire application environment no matter where it’s deployed. You can also customize it based on your needs.
  • Agentless: You don’t need to install any other software or firewall ports on the client systems you want to automate. You also don’t have to set up a separate management structure.
  • Efficient: Because you don’t need to install any extra software, there’s more room for application resources on your server.

Next, in our path to understanding what ansible is, let us find out the features and capabilities of Ansible.

Ansible Architecture:-

1. Modules

2. Plugins

3. Inventories

4. Playbooks

Each playbook is composed of one or multiple plays, and the goal of a play is to map a group of hosts to well-defined roles, represented by tasks.

5. APIs

Now that we’ve come this far to understand what Ansible is, let us next look into the Ansible tower.

What is Ansible Tower??

As we are learning more about what is Ansible, let us learn the several advantages of Ansible.

Advantages of Using Ansible With Docker:-

Ansible does a great job of automating Docker and operationalizing the process of building and deploying containers. If you’re managing a traditional IT system, for example, it can be hard to add container-tooling functionality. But Ansible removes the need to do processes manually. There are four main advantages of using Ansible with Docker:

1. Portability/Flexibility

2. Auditability

3. Management of Entire Environments

4. Similar Syntax

In order to get a complete understanding of what Ansible is, we will learn how Ansible can be used with Docker.

How to Use Ansible With Docker??

Managing Docker Containers Using Ansible Modules:-

Ansible Consulting Services:-

With the rapid digital transformation, the IT complexity is proliferating over time making tasks even more convoluted. So, with the growing business demands, the IT firms are struggling hard to develop, deploy, and maintain the sprawling systems. In the need of an hour, Ansible came to the aid of entire IT and DevOps team in terms of scaling automation, managing complex deployments and enhancing productivity.

So, if you are looking to create and standardize centralized automation practices that add business value and build a strong foundation for DevOps, then you are at the right place!!

No matter where you stand on your DevOps, Ansible automation can help.

Conclusion

Aviatrix Certified Engineer | DevOps | Python | Big Data | RHCSA 8 | AWS-CSA | AWS-DEVELOPER | Ansible | Docker | CKA & CKAD | GIT & GITHUB |