피드 구독

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:


저자 소개

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.

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

채널별 검색

automation icon

오토메이션

기술, 팀, 인프라를 위한 IT 자동화 최신 동향

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Original series icon

오리지널 쇼

엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리