Ansible Tutorial · Getting Started · Lesson 1 of 20

Ansible Introduction

What Ansible is, how it works, and when to use it.

Members can save this page, take notes and track progress. See membership · Sign in

What is Ansible?

Ansible is an open-source automation tool for configuring servers, deploying applications and orchestrating multi-step workflows. It is maintained by Red Hat and written in Python.

Ansible stands out because it is agentless: it connects to managed machines over SSH (Linux) or WinRM (Windows) and runs tasks remotely. There is nothing to install on the servers you manage — if they have Python and SSH, Ansible can configure them.

How Ansible works

  1. You write inventory files that list the machines you manage.
  2. You write playbooks in YAML that describe the desired state of those machines.
  3. Ansible connects to each machine, copies small Python scripts called modules, runs them, and reports the result.
  4. Modules are idempotent: running the same playbook twice produces the same result without breaking anything.
┌──────────────┐     SSH      ┌───────────────┐
│ Control Node │─────────────▶│ Managed Node  │
│ (your laptop │              │ (web-1)       │
│  or CI box)  │─────────────▶│ (web-2)       │
└──────────────┘              │ (db-1)        │
                              └───────────────┘

Ansible vs other tools

Feature Ansible Chef / Puppet Terraform
Agent None (agentless) Requires agent None
Language YAML Ruby DSL HCL
Transport SSH / WinRM Agent pull Cloud API
Best for Config mgmt Config mgmt Infrastructure
Idempotent Yes Yes Yes

Ansible and Terraform often work together: Terraform creates the infrastructure, Ansible configures the servers that Terraform created.

When to use Ansible

  • Server configuration: install packages, create users, set firewall rules.
  • Application deployment: pull code, run migrations, restart services.
  • Orchestration: coordinate rolling updates across a fleet.
  • Compliance: enforce a security baseline across every machine.

Ansible is a poor fit for tasks that need a long-running daemon with continuous drift detection; Chef or Puppet suit that model better.

Key terms

  • Control node: the machine where you run ansible or ansible-playbook. Must be Linux or macOS (not Windows as a control node).
  • Managed node: any machine Ansible configures (also called a "host").
  • Inventory: a file listing managed nodes, optionally grouped.
  • Module: a unit of work (install a package, copy a file, start a service).
  • Playbook: a YAML file containing one or more plays, each targeting a group of hosts with a list of tasks.
  • Role: a reusable, self-contained package of tasks, handlers, templates and variables.
  • Fact: information Ansible gathers about a managed node (OS, IP, RAM) before running tasks.
The key difference
echo "Ansible is agentless — it uses SSH, not a client agent."

Output

Ansible is agentless — it uses SSH, not a client agent.

Run this on your computer — see “Get Started” for setup.

Test yourself

What transport does Ansible use to connect to Linux managed nodes?

  1. HTTP
  2. SSH
  3. gRPC
  4. Agent pull
Show answer

Answer: SSH

Ansible is agentless and connects over SSH to Linux hosts (WinRM for Windows).

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake