Skip to main content

Ansible

Pronunciation
AN-sih-bul
Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/ansible

In short

Ansible is an open-source automation tool that configures servers and deploys applications by running YAML playbooks over SSH, with no agent on the machines.

What is Ansible?

Ansible was created by Michael DeHaan in 2012 and has been part of Red Hat since 2015. It automates the jobs people used to do by logging into servers one by one: installing packages, editing configuration files, creating users, restarting services and rolling out new versions of an application.

Work is described in playbooks, YAML files that list tasks to run on groups of hosts. Each task calls a module, such as apt to install a package, copy to place a file or service to restart a daemon. The machines to manage are listed in an inventory, and Ansible connects to them over SSH, or WinRM for Windows, so nothing needs to be installed on them beyond Python.

Most modules are idempotent: they check the current state first and only act if something differs. Running a playbook twice therefore leaves the servers in the same state, which makes it safe to apply a playbook again and again to keep a fleet consistent. Roles bundle reusable sets of tasks, and Ansible Galaxy shares community-built roles and collections.

A common misconception is that Ansible and Terraform compete. Terraform is usually used to create the infrastructure itself, while Ansible configures what runs on the machines; containers and immutable images have also replaced some of this work. Unlike tools such as Puppet or Chef, Ansible pushes changes from a control machine instead of running an agent on every server.

Key takeaways

  • Ansible automates server configuration and application deployment.
  • Tasks are written in YAML playbooks and run against an inventory of hosts.
  • It is agentless: it connects over SSH and needs only Python on the hosts.
  • Idempotent modules make it safe to run a playbook repeatedly.
  • It usually configures machines that tools like Terraform create.

Example

A playbook that installs and starts Nginxyaml
- name: Set up web servers
  hosts: web
  become: true
  tasks:
    - name: Install nginx
      ansible.builtin.apt:
        name: nginx
        state: present
        update_cache: true

    - name: Make sure nginx is running
      ansible.builtin.service:
        name: nginx
        state: started
        enabled: true

# Run with: ansible-playbook -i inventory.ini site.yml

Readers ask

Does Ansible need an agent on each server?

No. Ansible is agentless: it connects from a control machine over SSH (or WinRM on Windows) and runs its modules there, needing only Python on the managed hosts.

What is an Ansible playbook?

A YAML file that lists plays, each mapping a group of hosts to a series of tasks, such as installing packages, copying files and restarting services.

What does idempotent mean in Ansible?

That running the same task twice has the same result as running it once. A module that installs a package does nothing if the package is already installed.

Often compared

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings