Introduction
Ansible is one of the most popular Infrastructure as Code (IaC) and automation tools. It allows administrators to automate server configuration, software deployment, and repetitive operational tasks without installing agents on target servers. Ansible uses SSH and YAML-based playbooks, making it simple and powerful.
Prerequisites
- Linux, macOS, or WSL machine
- Python installed
- Sudo privileges
- SSH access to managed servers
Install Ansible on Ubuntu
sudo apt update
sudo apt install ansible -y
Verify installation:
ansible --version
Install Ansible on RHEL/CentOS/Rocky Linux
sudo dnf install ansible-core -y
Verify:
ansible --version
Install Ansible with pip
python3 -m pip install --user ansible
Or:
pip install ansible
Install Ansible on macOS
brew install ansible
Verify Connectivity
Create an inventory file:
[web]
192.168.1.100
``
Run a ping test:
ansible web -i hosts -m ping
Expected output:
SUCCESS => {
"ping": "pong"
}
Key Takeaways
- Ansible is agentless.
- Uses SSH for Linux automation.
- Control node needs Ansible installed.
- Managed nodes generally only need Python






