Skip to content

Install Ansible on Windows, Linux, and MacOS

📦 Prerequisites

  • Python 3.9 or later (except on Windows where WSL is recommended)
  • Administrator or sudo privileges
  • Internet connection

🪟 Windows (via WSL)

Ansible is not natively supported on Windows. Use Windows Subsystem for Linux (WSL).

  1. Enable WSL
wsl --install

:::info Restart your computer if prompted. :::

  1. Install a Linux distribution
  2. Open Microsoft Store and install Ubuntu (or another preferred distro).
  3. Launch Ubuntu from Start Menu
  4. Update packages
sudo apt update && sudo apt upgrade -y
  1. Install Ansible
sudo apt install software-properties-common -y
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
  1. Verify installation
ansible --version

🐧 Linux (Ubuntu/Debian)

  1. Update system
sudo apt update && sudo apt upgrade -y
  1. Install Ansible
sudo apt install software-properties-common -y
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
  1. Verify installation
ansible --version

🍎 macOS

  1. Install Homebrew (if not already installed)
/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

✅ Post-Installation Tips

  • Create an inventory file: /etc/ansible/hosts or a custom one.
  • Test with:
ansible all -m ping -i your_inventory_file