# Ansible

> A tool that sets up many servers at once. It reads its steps from a YAML file.

**Field:** Software Development  
**Category:** DevOps & Cloud  
**Also known as:** Ansible Playbook, Red Hat Ansible, ansible-playbook

## Think of it like

Think of it like a teacher who reads one list of steps to a class. Everyone does the same steps at once.

## Definition

Ansible is an open-source tool for setting up servers and doing IT jobs. You write the steps in a playbook, a YAML file that reads almost like a list. Ansible connects to each server over SSH and runs the steps. It needs no extra program on the servers. If you run a playbook again, it changes only what is different.

## Example

Lucy's playbook installs Nginx on five servers. She runs it once, and all five are set up in a minute.

## Example code

```yaml
- hosts: web
  become: true
  tasks:
    - name: Install nginx
      ansible.builtin.apt:
        name: nginx
        state: present
```

A playbook that makes sure Nginx is installed on every web server.

## Why it matters

One file sets up any number of servers the same way. Nothing extra goes on the servers.

## Common mistake

Running shell commands for every step. Use the built-in steps, so a second run does not redo the work.

## Three principles

- **Playbooks in YAML.** Steps that read like a list.
- **Over SSH.** No agent on the servers.
- **Safe to rerun.** Only differences change.

## Related terms

- [Configuration Management](https://learn.benibix.com/term/development/configuration-management)
- [Infrastructure as Code (IaC)](https://learn.benibix.com/term/development/infrastructure-as-code)
- [Terraform](https://learn.benibix.com/term/development/terraform)
- [YAML Ain't Markup Language (YAML)](https://learn.benibix.com/term/development/yaml)
- [GitOps](https://learn.benibix.com/term/development/gitops)
- [Secure Shell (SSH)](https://learn.benibix.com/term/infrastructure/ssh)

## Told apart from

- [Terraform vs Ansible](https://learn.benibix.com/compare/terraform-vs-ansible): Terraform makes the cloud parts, like servers and networks. Ansible sets up what runs on a server, like its programs and files. Many teams use Terraform to make the servers. Then they use Ansible to set them up.

![Two ways to keep servers set up the same. On the left, configuration management with Ansible: a playbook in YAML is pushed over SSH from one control machine to three servers, with no agent on them. On the right, GitOps, lit up: the wanted state lives in a Git repository, and an agent inside the cluster pulls it and keeps fixing any difference it finds.](https://learn.benibix.com/diagrams/dev3-config-mgmt.svg)

---

Source: https://learn.benibix.com/term/development/ansible
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
