Foundations / Lesson 1 of 3

How Ansible Works

See how one control node configures many machines over SSH without installing anything on them.

6 min Beginner 7 steps
Managed nodesplaybook.ymlweb-1web-2EngineerControl nodedb-1inventoryrun

IN THIS LESSON

Step 1 of 7

STEP 1 / 7

You work from a control node

Ansible runs on one machine, called the control node. It can be your laptop or a shared server. You type a command there, and Ansible does the rest.

$ ansible-playbook -i inventory playbook.yml

← → step · R replay · Space play/pause

YOU'LL LEARN

  • What a control node and managed nodes are
  • What playbooks and inventories do
  • Why Ansible is called agentless
  • How modules do the actual work
  1. You work from a control node. Ansible runs on one machine, called the control node. It can be your laptop or a shared server. You type a command there, and Ansible does the rest.
  2. A playbook describes the work. A playbook is a YAML file that says what should be true on your machines: which packages are installed, which files exist, which services run. It reads like a checklist.
  3. An inventory lists the machines. The inventory tells Ansible which machines exist and how to group them. The playbook says what to do, and the inventory says where.
  4. Managed nodes do the work. The machines Ansible configures are called managed nodes. They can be physical servers, virtual machines, containers or network devices.
  5. Agentless: it just uses SSH. Nothing permanent is installed on the managed nodes. Ansible connects over SSH, which is already there on Linux servers, and pushes work to them. For most Linux modules the node needs Python. Windows hosts are reached over WinRM or SSH instead.
  6. Modules do the real work. Each task in a playbook calls a module, a small program that does one job, such as installing a package. Ansible copies the module to the node, runs it, collects the result and removes it. Because modules check state first, running the same playbook twice is safe.
  7. Recap. Ansible is a push-based automation tool: one control node configures many machines over a connection they already have.