Skip to main content
cd ../lexicon
sys/docs/lexicon/ansible.md
Lexicon
Ansible

Ansible

Ansible is an open-source, agentless automation engine that uses declarative YAML playbooks and SSH or WinRM to configure systems, deploy applications and orchestrate multi-node workflows without installing persistent client software on managed nodes.
Difficulty: Intermediate
6 min read
Updated 2026-08-20

In plain English

Plain definition

Ansible is an open-source, agentless automation engine that uses declarative YAML playbooks and SSH or WinRM to configure systems, deploy applications and orchestrate multi-node workflows without installing persistent client software on managed nodes.

Technical definition

Ansible is an agentless, push-based configuration management and orchestration engine. Automation logic is expressed as declarative YAML documents called playbooks, composed of ordered plays and tasks. Each task invokes a named module (for example a package manager module or a file-state module) against a defined inventory of hosts. Ansible connects to managed nodes over SSH (or WinRM for Windows targets), transfers small Python (or PowerShell) payloads, executes them, and reports per-host results back to the control node. Idempotency is a design property of well-written modules and tasks: re-running the same playbook against a host already in the desired state should produce no further change.

Operational relevance

Ansible is used operationally for configuration drift remediation, application deployment, patch orchestration, network device configuration and infrastructure bootstrapping. Its agentless model reduces the attack surface and maintenance burden associated with persistent agents, but it also means correctness depends heavily on inventory accuracy, credential handling and network reachability at run time. Because playbooks execute with whatever privilege the connecting user holds (often elevated via become), least-privilege design of the control node’s credentials and the managed-node sudo policy is a material operational control, not an optional hardening step.

Architecture relationship

Ansible sits in the configuration-management and orchestration layer of an operational stack, typically above provisioning tools (which create compute, network and storage resources) and below or alongside deployment pipelines. In many toolchains Ansible is invoked from continuous-integration or continuous-delivery pipelines to apply configuration after infrastructure has been provisioned, or is used independently for fleet-wide configuration enforcement. Ansible Automation Platform (Red Hat’s commercial distribution) adds a control plane, role-based access control, credential vaulting and scheduling around the open-source engine, but the underlying execution model of inventories, playbooks and modules remains the same.

Example

A minimal playbook that ensures a package is present and a service is running on a group of hosts named webservers:

---
- name: Ensure nginx is installed and running
  hosts: webservers
  become: true
  tasks:
    - name: Install nginx
      ansible.builtin.package:
        name: nginx
        state: present
    - name: Ensure nginx is running
      ansible.builtin.service:
        name: nginx
        state: started
        enabled: true

Running this playbook in check mode first (a dry run) against a non-production inventory allows an engineer to see what would change before applying it to real hosts.

Common misunderstanding

A frequent misunderstanding is that Ansible is inherently idempotent by virtue of using the tool at all. Idempotency is a property of individual modules and how tasks are written, not a guarantee provided automatically by the engine. A task built around a raw shell or command module that runs an imperative command (for example, appending a line to a file with echo >>) can produce a different result on every run. Reliable, safely repeatable automation depends on using state-declaring modules and testing playbooks in check mode before applying them at scale.

  • Playbook — the YAML file defining plays and tasks that Ansible executes.
  • Inventory — the list of managed hosts and groups a playbook targets.
  • Module — the unit of work (for example, package, service, file) that a task invokes.
  • Idempotency — the property that re-running the same operation produces no unintended additional change.
  • Ansible Vault — the built-in mechanism for encrypting sensitive variables and files within a playbook repository.

Further reading and verification

Readers evaluating Ansible for a specific environment should confirm the exact platform version, supported connection plugins and privilege-escalation configuration against the current vendor documentation before relying on any version-specific behaviour, since automation-tool release cadence and module deprecations change over time.