Skip to content

Ansible

In one line

Ansible is an open-source automation tool that configures servers and deploys software using simple YAML playbooks.

In simple words

Ansible is a tool for automating configuration management and application deployment. Instead of manually SSH-ing into servers to install packages and configure services, you write playbooks in YAML that describe the desired state.

Ansible is agentless — it doesn't require any software installed on the target servers. It uses SSH to connect and run commands. This makes it simple to set up and use.

A playbook contains tasks like "install nginx", "copy this config file", "start this service". Ansible runs these tasks on your servers in order. It is idempotent — running the same playbook multiple times produces the same result, so you can safely run it again and again.

Example

yaml
- name: Install and start nginx
  hosts: webservers
  tasks:
    - name: Install nginx
      apt:
        name: nginx
        state: present
    - name: Start nginx
      service:
        name: nginx
        state: started
        enabled: yes

This playbook installs nginx on all servers in the 'webservers' group and ensures it is running.

How it works

  1. You write a playbook in YAML describing tasks to run.
  2. You define an inventory file listing your target servers.
  3. ansible-playbook connects via SSH and runs tasks in order.
  4. Ansible checks the current state and only makes changes if needed (idempotent).

Common confusions

  • Confused with: Terraform

    The difference: Ansible configures existing servers (installs software, manages files); Terraform creates the servers themselves (infrastructure provisioning).

Related terms

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary