Ansible Intro
6 min read
Ansible automates server configuration with YAML playbooks run over SSH. The apt, service, copy, and template modules cover most tasks. Run on many servers simultaneously without installing any agent software.
Ansible — Infrastructure Automation
pip install ansible
# inventory.ini
[webservers]
server1 ansible_host=192.168.1.10
server2 ansible_host=192.168.1.11
# Ping all
ansible -i inventory.ini all -m ping
# Playbook — deploy.yml
- hosts: webservers
tasks:
- name: Install nginx
apt: name=nginx state=present
- name: Start nginx
service: name=nginx state=started enabled=yes