ansible-playbook command not found

In this troubleshooting guide we learn how to fix ansible-playbook command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

ansible-playbook: command not found

or when using sudo you get the following error message

sudo: ansible-playbook: command not found

Solutions to ansible-playbook: command not found

How To Fix ansible-playbook: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu ansible-playbook is provided by ansible package.

ansible is:

Ansible is a radically simple model-driven configuration management, multi-node deployment, and remote task execution system. Ansible works over SSH and does not require any software or daemons to be installed on remote nodes. Extension modules can be written in any language and are transferred to managed machines automatically.

This package contains ansible-base 2.10.x and ansible-collections 2.10.x merged into one package.

To fix this problem, we can install more using the command below.

sudo apt-get -y install ansible

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install ansible.

sudo apt -y install ansible

Or if you have aptitude installed you can use the following command.

sudo aptitude install ansible

Summary

In this tutorial we learn how to fix ansible-playbook command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.