It’s always better to work smarter and not harder. Imagine that every time you need to receive some important data, you have to repeat certain tasks. You have to follow the same steps over and over and over. Each set of steps takes an hour to complete. Now multiply that set times 10. Who has that kind of time?
Automating processes is my favorite way to solve this kind of problem. And my favorite tool for automation is Ansible, not just because of its excellent reputation. I use Ansible because it's come to my rescue time and time again.
What is Ansible?
Ansible can change the way you manage infrastructure.
It is considered a DevOps tool because it can help you manage system configuration, development, provisioning, and more by using secure shell (SSH) to communicate between systems.
It utilizes playbooks, written in the simple language YAML, to translate what you define as true in your infrastructure into actions your systems must take to meet that definition.
[ Keep your favorite commands close at hand. Download the advanced Linux commands cheat sheet. ]
Why use Ansible?
It’s essential to provide reliability, scalability, and consistency within your infrastructure. Ansible supports all of these crucial areas and ensures that the required packages and programs are installed and configured correctly.
It also gives you access to previous versions and other historical data. Any time you want to roll back or upgrade, you can do so seamlessly.
Here are some of Ansible's essential features:
- Agentless: There isn't a central node managing Ansible.
- Python: Ansible is written in the popular coding language Python, so even intermediate coders can write modules for it. Don't worry if Python isn't your language of choice. You can write modules in other languages, too.
- Push architecture: Ansible allows you to push configurations (defined in YAML playbooks) to all client nodes at once. This shows how powerful this tool can be. Imagine pushing to thousands of servers at once, with minimal setup time!
Now that I've covered what Ansible is, I'll cover the basics of how it works.
[ Want to test your sysadmin skills? Take a skills assessment today. ]
Ansible architecture
It all starts with the playbook.
Through the Ansible automation engine, you can push actions defined in a playbook over to any number of client hosts. The host inventory file defines which computers on your network are clients.
Here's a simple playbook that ensures a set of target hosts (all clients in the group webhosts
, which would be defined in the host inventory file) have the latest httpd
installed and configured to run:
---
- name: Web servers
hosts: webhosts
tasks:
- name: Install httpd package
dnf:
name: httpd
state: latest
- name: Start and enable httpd service
service:
name: httpd
enabled: true
state: started
Ansible modules are what make such a simple playbook as this example possible. Modules are scripted programs that are executed when running a playbook. There are hundreds of modules bundled with Ansible, and even more are available from its community of users.
A playbook consists of plays, or tasks that call modules. When you run a playbook, you’re calling on the modules referenced in your YAML to complete requests on the host machines.
Plugins are executed before modules. There are many different types of plugins: cache plugins, callback plugins, action plugins, and more. For example, Ansible uses a connection plugin to ensure it can connect to hosts. It usually uses SSH, but you can use a Docker plugin to enable Ansible to connect to and manage containers instead.
[ Need more on Ansible? Take a no-cost technical overview course from Red Hat. Ansible essentials: Simplicity in automation technical overview. ]
Ansible at work
Ansible works by connecting to nodes and executing scripted programs as Ansible modules. By default, Ansible executes modules over SSH. The computer you're using to run the playbook is called the Ansible management node, and it controls the entire playbook. It makes the connection, executes the modules on the target hosts, and performs whatever actions are required by the playbook.
Automation helps tremendously in nearly any organization. It ensures easy access to all the computers on your network and gives you peace of mind knowing that your systems will retain their integrity over time. And this happens without creating memory-hungry daemons running in the background. There are plenty of options and plenty of reasons to use specific systems. With Ansible, there is endless opportunity.
Here are some articles to help you learn Ansible:
About the author
I currently work as a Cloud Support Supervisor for Acronis . I have worked with Linux and OpenSource tools for a decade, constantly wanting to make new resolutions for obstacles and always training others on improving systems as a systems administrator. I’ve helped manage and maintain elaborate servers and websites over the years. In my spare time, I enjoy spending time with my dogs, reading, and playing video games.
Browse by channel
Automation
The latest on IT automation for tech, teams, and environments
Artificial intelligence
Updates on the platforms that free customers to run AI workloads anywhere
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
The latest on how we reduce risks across environments and technologies
Edge computing
Updates on the platforms that simplify operations at the edge
Infrastructure
The latest on the world’s leading enterprise Linux platform
Applications
Inside our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Customer support
- Developer resources
- Find a partner
- Red Hat Ecosystem Catalog
- Red Hat value calculator
- Documentation
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit