Automating Server Configs with Ansible
Nov 5, 2024
Stop configuring servers by hand. Use Ansible playbooks to ensure consistency across your entire fleet.
Ansible is an open-source automation tool, or platform, used for IT tasks such as configuration management, application deployment, intraservice orchestration, and provisioning.
Your First Playbook
Here is a simple playbook to install Apache on a Debian-based system:
---
- hosts: webservers
become: true
tasks:
- name: Ensure Apache is at the latest version
apt:
name: apache2
state: latest
- name: Ensure Apache is running
service:
name: apache2
state: started
enabled: yes
Inventory
Simplicity is key.
[webservers]
192.168.1.50
192.168.1.51
Running this ansible-playbook -i inventory site.yml will configure all your servers at once.