Ansible
In one line
Ansible is an open-source automation tool that configures servers and deploys software using simple YAML playbooks.
In simple words
Ansible is a tool for automating configuration management and application deployment. Instead of manually SSH-ing into servers to install packages and configure services, you write playbooks in YAML that describe the desired state.
Ansible is agentless — it doesn't require any software installed on the target servers. It uses SSH to connect and run commands. This makes it simple to set up and use.
A playbook contains tasks like "install nginx", "copy this config file", "start this service". Ansible runs these tasks on your servers in order. It is idempotent — running the same playbook multiple times produces the same result, so you can safely run it again and again.
Example
- name: Install and start nginx
hosts: webservers
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Start nginx
service:
name: nginx
state: started
enabled: yesThis playbook installs nginx on all servers in the 'webservers' group and ensures it is running.
How it works
- You write a playbook in YAML describing tasks to run.
- You define an inventory file listing your target servers.
ansible-playbookconnects via SSH and runs tasks in order.- Ansible checks the current state and only makes changes if needed (idempotent).
Common confusions
Confused with: Terraform
The difference: Ansible configures existing servers (installs software, manages files); Terraform creates the servers themselves (infrastructure provisioning).
Related terms
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.