Ansible: Install

Ubuntu 22.04

  1. Update your package index:
sudo apt update
  1. Install Ansible:
sudo apt install ansible -y
  1. Verify installation:
ansible --version

macOS (using Homebrew)

  1. Install Homebrew if you don't have it:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install Ansible:
brew install ansible
  1. Verify installation:
ansible --version

Windows

Ansible runs natively on Unix-like systems. On Windows, use Windows Subsystem for Linux (WSL):

  1. Enable WSL and install Ubuntu from Microsoft Store.
  2. Open Ubuntu (WSL) and follow Ubuntu installation steps above:
sudo apt update
sudo apt install ansible -y
ansible --version

Alternatively, for advanced users, you can use pip in PowerShell (for WSL-less install, but some features may not work):

pip install ansible
ansible --version

Now Ansible is installed and ready to use on your system.