Ansible - Installation - Version 2.7 on Linux

Card Puncher Data Processing


How to install Ansible on Linux.


  • using the OS package manager for Red Hat Enterprise Linux (TM), CentOS, Fedora, Debian, or Ubuntu, we recommend
  • using Pip

Python installation

Ansible’s “raw” module don’t even need Python installed. So technically, you can use Ansible to install a compatible version of Python using the raw module, which then allows you to use everything else.


ansible host-pattern --become -m raw -a "yum install -y python2"


By default, Ansible uses the python interpreter located at /usr/bin/python to run its modules.

If it's not the case, you can set the ansible_python_interpreter inventory variable to point at your interpreter


See Install Ansible

  • Ubuntu
## Install pre-requisite packages
sudo apt-get update && sudo apt-get install -y libssl-dev libffi-dev python-dev python-pip

## Install Ansible and Azure SDKs via pip
sudo pip install ansible[azure]
  • Centos
sudo yum check-update; sudo yum install -y gcc libffi-devel python-devel openssl-devel epel-release
sudo yum install -y python-pip python-wheel

Test if Ansible is installed

From Ansible task …?

- name: Install ansible
  yum: pkg=ansible state=installed


pip show ansible
Metadata-Version: 1.1
Name: ansible
Version: 2.7.1
Summary: Radically simple IT automation
Author: Ansible, Inc.
Author-email: [email protected]
License: GPLv3+
Location: /usr/lib/python2.7/dist-packages
  Development Status :: 5 - Production/Stable
  Environment :: Console
  Intended Audience :: Developers
  Intended Audience :: Information Technology
  Intended Audience :: System Administrators
  License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
  Natural Language :: English
  Operating System :: POSIX
  Programming Language :: Python :: 2
  Programming Language :: Python :: 2.7
  Programming Language :: Python :: 3
  Programming Language :: Python :: 3.5
  Programming Language :: Python :: 3.6
  Programming Language :: Python :: 3.7
  Topic :: System :: Installation/Setup
  Topic :: System :: Systems Administration
  Topic :: Utilities



“module_stdout”: “/bin/sh: /usr/bin/python: No such file or directory\r\n”

Verify your interpreter

Discover More
Card Puncher Data Processing
Ansible - Installation

An installation page that stores requirement and links to the OS installation The control machine is where Ansible run. Ansible can be run from any machine with Python 2 (version 2.7) or Python...

Share this page:
Follow us:
Task Runner