Ansible is an agentless automation tool for configuring servers and deploying software, maintained by Red Hat (part of IBM). It's the #24 most-used developer tool, reported in roughly 11.7% of developer surveys. It uses simple YAML "playbooks" to describe the desired state of a fleet of machines, then pushes changes over plain SSH โ with no agent software to install or maintain on the target machines, unlike competitors such as Puppet or Chef.
An Ansible playbook is plain YAML describing tasks to run on a group of hosts โ here it installs and starts nginx on all web servers.
# site.yml
- hosts: webservers
become: true
tasks:
- name: Install nginx
apt:
name: nginx
state: present
update_cache: true
- name: Ensure nginx is running
service:
name: nginx
state: started
enabled: true
Install Ansible on a single control machine โ it only needs SSH access to target servers, no agent to deploy anywhere.
# install via pip
pip install ansible
# run a playbook against an inventory of hosts
ansible-playbook -i inventory.ini site.yml