Ansible Automation Platform
Ansible automates Linux/Unix systems with its agentless architecture. It works over SSH without requiring agent installation on target systems.
Ansible Installation
# RHEL/CentOS
sudo dnf install ansible-core
Version check
ansible --version
Inventory Configuration
# inventory.yml
[webservers]
web1.example.com
web2.example.com
[dbservers]
db1.example.com
[all:vars]
ansible_user=ansible
ansible_python_interpreter=/usr/bin/python3
Ad-hoc Commands
# Ping test
ansible all -m ping
Command execution
ansible webservers -m shell -a "uptime"
Package installation
ansible webservers -m dnf -a "name=httpd state=present" -b
Playbook Example
# webserver.yml
---
- name: Web Server Configuration
hosts: webservers
become: yes
tasks:
- name: Install Nginx
dnf:
name: nginx
state: present
- name: Start Nginx
service:
name: nginx
state: started
enabled: yes</code></pre>
Conclusion
Ansible can configure 100+ servers in minutes. Its idempotent nature allows safe re-execution.