Ansible Architecture Overview
Ansible follows a simple yet powerful architecture based on a control node and managed nodes. The control node executes automation tasks defined in playbooks and communicates with managed nodes over standard protocols.
Unlike agent-based systems, Ansible does not require any software to be installed on managed hosts other than Python and an SSH server.
Core Components
- Control Node — system where Ansible is installed
- Inventory — list of managed hosts and groups
- Modules — reusable units of work
- Playbooks — YAML files describing automation workflows
- Facts — system information gathered from hosts
Basic Workflow
The typical Ansible workflow consists of defining an inventory,
writing playbooks, and executing them using the ansible-playbook
command.
ansible-playbook -i inventory.ini site.yml
During execution, Ansible connects to each target host, transfers the required modules, executes them, and returns the results to the control node.
Idempotency
One of the key design principles of Ansible is idempotency. Tasks can be executed multiple times without changing the system beyond the desired state.