Skip to content
ansible: command not found

ansible: command not found

DodaTech 2 min read

The “ansible: command not found” error means the Ansible CLI is not installed on your system. The shell cannot locate the ansible binary in any directory listed in your PATH environment variable.

What It Means

Your operating system searched through all directories in PATH for an executable named ansible and found none. Ansible is either not installed, or its installation directory is not included in PATH.

Why It Happens

  • Ansible is not installed on the machine.
  • Ansible was installed via pip but for a different Python version or user.
  • The installation directory (e.g., ~/.local/bin) is not in your PATH.
  • You are inside a minimal container or virtual environment that lacks Ansible.
  • The package manager installation failed or was incomplete.

How to Fix It

Install Ansible via pip (recommended)

pip install ansible

If you get a permission error, use --user:

pip install --user ansible

Install via package manager

Ubuntu / Debian:

sudo apt update
sudo apt install ansible -y

CentOS / RHEL / Fedora:

sudo yum install epel-release -y
sudo yum install ansible -y

macOS (Homebrew):

brew install ansible

Ensure ~/.local/bin is in PATH

export PATH="$HOME/.local/bin:$PATH"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Verify installation

ansible --version

Expected output shows the Ansible version number and configuration file location.

FAQ

Do I need Python to install Ansible?
Yes. Ansible is a Python-based tool. Install Python 3.6+ first with sudo apt install python3 python3-pip (Debian/Ubuntu) or brew install python (macOS).
Why does 'ansible --version' still fail after install?
The pip binary directory may not be in your PATH. Run python3 -m pip show ansible to locate the installation, then add the reported directory to your PATH.
What is the difference between ansible-core and ansible?
ansible-core contains the core engine and a minimal set of modules. The ansible package includes the full Ansible Community Collection. Install ansible for most use cases.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro