Skip to main content

Demystifying Ansible for Linux sysadmins

Taking the labor out of labor-intensive tasks is what Ansible is all about. Learn the basics here.
Image
Demystifying Ansible

Photo by Aphiwat chuangchoem from Pexels

The life of a sysadmin involves installation, configuration, performing regular system upgrade and maintenance activities, provisioning, system monitoring, vulnerability mitigation, troubleshooting issues, and much more. Many sysadmin actions consist of step-by-step tasks performed methodically. So how can we make the life of a sysadmin easier?

[ Readers also enjoyed: An introduction to Ansible Tower ]

Automate to accelerate

You can bring in automation to save time, avoid repetitive tasks, prevent manual errors, and deploy/manage your systems in a more efficient manner. Automation allows sysadmins to focus their attention on other areas that add value to themselves and their organization. Let me begin by introducing Ansible—an open source automation tool used for common IT tasks such as provisioning, configuration management, application deployment, system monitoring, etc. Ansible is one of the leading automation tools used worldwide, and its simplicity is quickly garnering more attention.

Why Ansible?

Well, to begin with, Ansible is an open source automation engine. It is easy to deploy and use because you do not need any special coding skills to use Ansible for automation. It uses a playbook to describe automation jobs using Yet Another Markup Language (YAML). The various built-in Ansible modules cater to even complex IT workflows. The simplicity lies in the fact that Ansible is agent-less and does not require any additional software/client to be installed. Thus, Ansible helps bring about automation for carrying out system administration tasks in an easy, efficient, and time-saving manner.

How does Ansible work?

To begin your automation journey using Ansible, you must first install it in a node, which is referred to as the Ansible management node. This is where you will be creating your code/playbooks for automation. The target nodes where the Ansible playbook runs are called managed hosts. You can configure SSH key-based authentication from the management node to managed hosts for Ansible to work seamlessly. After connecting to the nodes, Ansible pushes small programs called Ansible Modules, which will perform the desired action on the target systems.

Ansib-Lingo

  • Playbooks - Files where Ansible code is written in YAML. This is analogous to a to-do list for the Ansible engine containing a list of tasks to be performed sequentially.
  • YAML - Yet Another Markup Language. YAML is a very easy, human-readable language. There are libraries available in most programming languages for working with YAML.
  • Inventory - List of nodes that can be managed by Ansible (hosts and groups). You can also define variables in the inventory file.
  • Ad-hoc commands - Pre-defined modules provided by Ansible that can be run directly for ease of use.
  • Modules - Ready-to-use programs that are pushed by Ansible management node to remote managed hosts to execute a task and then remove them once done.

Use cases for sysadmin

  • Automated system monitoring reports - Filesystem usage, application availability, database availability, and URL availability.
  • System maintenance activities - Automate starting and stopping applications and databases.
  • Performing automated system upgrades - SAP kernel upgrade, SAP host agent upgrade, OS upgrade, and Oracle SBP upgrade.
  • Performing Disaster Recovery drills - Switch to a DR site and back seamlessly using automation.
  • Automate provisioning, application deployment, configuration management, and adherence to security policies.
  • Ansible integration with Red Hat Satellite, VMware, AWS Cloud, and Azure Cloud.

[ Looking for more on system automation? Get started with The Automated Enterprise, a free book from Red Hat. ] 

Wrap up

This article gives you a brief introduction and overview of the concepts and terms associated with Ansible. We will cover more about setting up Ansible and the creation of playbooks in the upcoming articles.

Image
Galaxy
Ansible Galaxy is a repository for Ansible Roles that are available to drop directly into your Playbooks to streamline your automation projects.
Topics:   Linux   Ansible   Automation  
Author’s photo

Pratheek Prabhakaran

Pratheek is a Sysadmin at a Fortune 500 company in India where he specializes in IT automation with Ansible. He has experience in SAP Basis, RHEL Satellite, AWS Cloud, and VMware Administration. An avid reader, cricketer, and artist. More about me

Try Red Hat Enterprise Linux

Download it at no charge from the Red Hat Developer program.