Ansible configures existing servers. It's agentless and uses SSH.
When to use Ansible vs Terraform:
- Terraform: Provision infrastructure (create VMs, networks)
- Ansible: Configure infrastructure (install packages, deploy apps)
Playbook example:
- hosts: webservers
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Start nginx
service:
name: nginx
state: started
Interview tip: Know that Ansible is idempotent. Running a playbook twice produces the same result. This makes it safe to re-run.