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 OverflowHow to install ansible on amazon aws? - Stack Overflow
How To Install Ansible Offline?
Could I use Ansible to set up Linux (DistroHopping)?
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.txtMore on reddit.com
Videos
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
Using pip (alone, not in conjunction with yum) is probably the best option right now on Amazon Linux. I'd suggest getting rid of the yum-installed copy if it's still there.
The RPM specs in epel and epel-testing (as of 1.9.2) currently handle only RHEL, Fedora, and SuSE, and the defaults are installing everything under Python 2.6, where the latest Amazon Linux has default Python 2.7. A bit of work will be required to get the RPM install working under Amazon Linux...
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:
Locate where Python is installed using the following command:
which python3Ensure that
pip(part of Python) is installed by running this command:python3 -m pip -VIf 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,
pipis available, and you can move on to the next step.If you see an error like
No module named pip, you’ll need to installpipunder your chosen Python interpreter before proceeding. This may mean installing an additional OS package (for example,python3-pip), or installing the latestpipdirectly 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 --userInstall Ansible for the current user using
pipin 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.
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
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.