It appears that python library files do not have correct permissions by default. Running this fixed it for me.

[root@ip-10-0-0-11 ansible]# pip install ansible
Answer from Keilo on Stack Overflow
🌐
Ansible
docs.ansible.com › projects › ansible › latest › installation_guide › intro_installation.html
Installing Ansible — Ansible Community Documentation
The ansible or ansible-core packages may be available in your operating systems package manager, and you are free to install these packages with your preferred method. For more information, see the Installing Ansible on specific operating systems guide.
🌐
Ansible
docs.ansible.com › projects › ansible › latest › installation_guide › installation_distros.html
Installing Ansible on specific operating systems — Ansible Community Documentation
If you use CentOS Stream, Almalinux, Rocky Linux, or related distributions, you can install ansible or Ansible collections from the community-maintained EPEL (Extra Packages for Enterprise Linux) repository: Enable the EPEL repository. Use the same dnf commands as for Fedora Linux.
Discussions

How to install ansible on amazon aws? - Stack Overflow
Having trouble running Ansible on the latest version of amazon linux. [root@ip-10-0-0-11 ec2-user]# yum install ansible --enablerepo=epel [root@ip-10-0-0-11 ec2-user]# ansible-playbook Traceback (... More on stackoverflow.com
🌐 stackoverflow.com
How To Install Ansible Offline?
Had to do this for a previous job. Build a container that includes ansible in an online environment and ship the artefact to the offline one. You can handle all your dependencies such as pip packages, and even include playbooks and roles into it. All you need at the other end is docker. More on reddit.com
🌐 r/ansible
23
2
November 19, 2024
Could I use Ansible to set up Linux (DistroHopping)?
Try. You’ll figure it out. :) (Yes you can, but there are distribution specific things you’ll need to take into account such as package names, download urls for drivers and so on. But things like dot files and other user config can easily be copied/templated.) More on reddit.com
🌐 r/ansible
8
2
August 15, 2023
Best way to update Ansible on Ubuntu

You should probably consider installing via pip into a virtualenv. It can live in parallel to the system version without interfering at all. You can test out the new version without uninstalling anything.

Install some tools

apt-get install build-essential python-dev python-pip python-setuptools python-wheel libkrb5-dev krb5-user virtualenv virtualenvwrapper

Add some variables to your environment

export PROJECT_HOME=$HOME/Projects
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENV_PYTHON=/usr/bin/python3

maybe add the above to a file /etc/profile.d/py_virtualenvs.sh (mode: 0775)

Create a requirements.txt like this maybe?

ansible
ansible-lint
dnspython
pywinrm
requests-credssp
requests-kerberos

Create a virtualenv, and install ansible

virtualenv ansible_pip
source ansible_pip/bin/activate
pip install -i -U -r requirements.txt
More on reddit.com
🌐 r/ansible
16
5
September 17, 2018
🌐
Server Academy
serveracademy.com › courses › ansible-for-complete-beginners › installing-ansible-on-linux
Installing Ansible on Linux
In this lesson, you'll learn how to install Ansible on your ansible-controller VM that you set up in the previous lessons. Additionally, if you are using a Linux-based host computer, the process to install Ansible directly on your host will be similar.
🌐
Spacelift
spacelift.io › blog › how-to-install-ansible
How to Install Ansible on Ubuntu, RHEL, macOS & CentOS
You can easily install Ansible on a range of operating systems, including Ubuntu, RHEL, CentOS, MacOS, and Windows, regardless of your platform. Although Windows cannot directly serve as an Ansible control node due to its reliance on Python and SSH, the are some workarounds, like using Windows Subsystem for Linux (WSL), Docker, or a virtual machine to manage Windows as a managed node.
Published   October 10, 2025
Top answer
1 of 2
1

Ansible has an installation guide ready which will guide you through any missing dependencies as well: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html

There is also the development version on GitHub: https://github.com/ansible/ansible

Here are the basic guidelines, taken from the guide above:

  1. Locate where Python is installed using the following command:

    which python3
    
  2. Ensure that pip (part of Python) is installed by running this command:

    python3 -m pip -V
    

    If all is well, you should see something like the following:

    pip 21.0.1 from /usr/lib/python3.9/site-packages/pip (python 3.9)
    

    If so, pip is available, and you can move on to the next step.

    If you see an error like No module named pip, you’ll need to install pip under your chosen Python interpreter before proceeding. This may mean installing an additional OS package (for example, python3-pip), or installing the latest pip directly from the Python Packaging Authority by running the following:

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    python3 get-pip.py --user
    
  3. Install Ansible for the current user using pip in your selected Python environment:

    python3 -m pip install --user ansible
    

You haven't mentioned your Ubuntu release installation, so I assume you can have something above 18.04, for which the above should work out fine.

For anything extra, refer to the guide and Ansible's official website, mentioned in the start of this answer.

Good luck.

2 of 2
0

If you are looking to use a package manager to maintain/install Ansible, you will want to use the directions provided in the Ansible documentation. This requires you to install and enable the Ansible ppa repository.

$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository --yes --update ppa:ansible/ansible
$ sudo apt install ansible

Source: https://docs.ansible.com/ansible/latest/installation_guide/installation_distros.html#installing-ansible-on-ubuntu

Find elsewhere
🌐
Reddit
reddit.com › r/ansible › how to install ansible offline?
r/ansible on Reddit: How To Install Ansible Offline?
November 19, 2024 -

Hello everyone,

I'm trying to install Ansible on a machine (Ubuntu 20.04) that doesn't have direct access to the internet. I need a way to download all the required dependencies and set up Ansible offline.

Could anyone share a guide on how to install Ansible offline, including handling dependencies and configurations? I’d appreciate any advice or resources that can help with this.

Top answer
1 of 8
15
Had to do this for a previous job. Build a container that includes ansible in an online environment and ship the artefact to the offline one. You can handle all your dependencies such as pip packages, and even include playbooks and roles into it. All you need at the other end is docker.
2 of 8
11
If you've already got python and pip installed on the destination box, then you should be able to use pip, I generally do this using a python virtual environment because I may have multiple version of Python installed and multiple versions of Ansible installed (for developing collections), Box with access (and same version of python): mkdir ansible-download cd ansible-download python -m venv ansible-venv # Creates a virtual environment source ansible-venv/bin/activate # "Activates" the environment pip download pip # Download/Install the latest pip pip install --no-index --upgrade pip-24.3.1-py3-none-any.whl pip download ansible # Download the latest "ansible" package (core + collections) deactivate # "Deactivates" the environment rm -rf ansible-venv # Deletes the environment Using your mechanism of choice copy the ansible-download folder to your "disconnected" box cd ansible-download python -m venv ansible-venv ; source ansible-venv/bin/activate pip install --no-index --upgrade pip-24.3.1-py3-none-any.whl pip install --no-index --find-links=./ ansible-10.6.0-py3-none-any.whl (pip/ansible versions may vary) On the disconnected box you can skip the "venv" and "activate" if you want to install into your system python environment rather than a dedicated temporary environment
🌐
ArchWiki
wiki.archlinux.org › title › Ansible
Ansible - ArchWiki
December 29, 2023 - Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs. On the control machine (master), install the ansible-core package.
🌐
Linux.org
linux.org › home › forums › linux.org news, tutorials and articles › linux original content › linux articles › shell / command line
Ansible Series Part 1: Intro and Getting Set Up | Linux.org
January 24, 2025 - Don't worry about the others for right now. If your distro doesn't have ansible as a package, you can install it with something called pip or pip3. Warning:: DO NOT mix vendor and pip installs of ansible. Pick one and stick with it. Mixing the two will break things.
🌐
Red Hat
redhat.com › en › blog › ansible-quick-start
Quick start guide to Ansible for Linux sysadmins
November 24, 2025 - To use Ansible in your environment, you must set up a management node (also called a control node) where you will install Ansible. You can install Ansible on any machine with Python 2 (version 2.7) or Python 3 (versions 3.5 and higher).
🌐
Ansible
docs.ansible.com › projects › ansible › latest › installation_guide › index.html
Installation Guide — Ansible Community Documentation
Installing Ansible on Fedora Linux · Installing Ansible from EPEL · Installing Ansible on OpenSUSE Tumbleweed/Leap · Installing Ansible on Ubuntu · Installing Ansible on Debian · Installing Ansible on Arch Linux · Installing Ansible on Windows · Configuring Ansible ·
🌐
Liquid Web
liquidweb.com › home › how to install and configure ansible on almalinux
How to Install and Configure Ansible on AlmaLinux | Liquid Web
April 4, 2025 - The Ansible package and its dependencies are unavailable in AlmaLinux 9’s default package repositories. The EPEL repository must first be configured to install Ansible AlmaLinux using the dnf command. Install the EPEL repository on the system by executing the below command.
🌐
Rocky Linux Documentation
docs.rockylinux.org › 10 › books › learning_ansible › 01-basic
Ansible Basics - Documentation
To offer a graphical interface to your daily use of Ansible, you can install some tools like Ansible Tower (RedHat), which is not free, its opensource counterpart Awx, or other projects like Jenkins and the excellent Rundeck can also be used. ... the second one will be the server to configure and manage (another Linux than Rocky Linux will do just as well).
🌐
TecMint
tecmint.com › home › open source › how to install and configure ‘ansible’ automation tool for it management – part 1
How to Install and Configure 'Ansible' Automation Tool for IT Management - Part 1
October 14, 2015 - Part 2: How to Use Anisble Playbooks to Automate Complex Tasks on Multiple Remote Servers · Part 3: How to Automate Simultaneous WordPress Deployments in Multiple Linux Servers Using Ansible · Part 4: Managing Encrypted YAMAL data with Ansible-Vault · In this article, we will show you how to install ‘Ansible’ on RHEL/CentOS 7/6, Fedora 21-19, Ubuntu 14.10-13.04 and Debian 7/6 systems and also we will go through some basics on how how to manage a server by installing packages, applying updates and much more from basic to pro.
🌐
Red Hat
developers.redhat.com › blog › 2016 › 08 › 15 › install-ansible-on-rhel
Install Ansible on Red Hat Enterprise Linux | Red Hat Developer
March 16, 2023 - I’ll cover both in this article. Ansible is not available in the default RHEL repositories, so we need to install Extra Packages for Enterprise Linux (EPEL) in order to install it via yum.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-and-configure-ansible-on-ubuntu-22-04
How To Install and Configure Ansible on Ubuntu | DigitalOcean
March 30, 2026 - In this tutorial, you will install and configure Ansible on an Ubuntu server, set up an inventory of managed hosts, verify connectivity, run ad-hoc commands, and write your first playbook. You will also learn about the different installation methods available, including the Ansible PPA, the default Ubuntu repository, and pipx, so you can choose the approach that fits your environment.
🌐
Medium
medium.com › techbeatly › how-to-install-ansible-ansible-installation-guide-0a8103a50a63
How to Install Ansible | Ansible Installation Guide | by Nikhil Kumar | techbeatly | Medium
November 5, 2024 - How to Install Ansible | Ansible Installation Guide If you’re looking to install Ansible without the hassle of a Red Hat subscription, using pip is the easiest way to get started! Whether you’re …
🌐
nixCraft
cyberciti.biz › nixcraft › howto › ubuntu linux › installing and configuring the latest version of ansible
How to Install latest version of Ansible on Ubuntu Linux - nixCraft
September 16, 2024 - Explains how to install and configure latest version of Ansible on Ubuntu Linux version 16.04/18.04/20.04 LTS desktop or server.
🌐
OpenClaw
docs.openclaw.ai › install › ansible
Ansible - OpenClaw
Use this file to discover all available ... — an automated installer with security-first architecture. The openclaw-ansible repo is the source of truth for Ansible deployment. This page is a quick overview. Firewall-first security — UFW + Docker isolation (only SSH + Tailscale ...