Task Requirement :
During the weekly meeting, the DevOps team discussed the automation and configuration management solutions that they wanted to implement. While considering several options, the team has decided to go with Ansible for now due to its simple setup and minimal prerequisites. The team wanted to start testing using Ansible, so they decided to use a jump host as an Ansible controller to test different kinds of tasks on the rest of the servers.
Install ansible version 4.8.0 on Jump host using pip3 only.
Make sure Ansible binary is available globally on this system, i.e all users on this system are able to run Ansible commands.
Execution :
To install Ansible version 4.7.0 on a Red Hat Jump host server using pip3 and make it available globally for all users, you can follow these steps.
Update pip3
sudo pip3 install --upgrade pip
Install Ansible 4.8.0
sudo pip3 install ansible==4.8.0
Verify the installation
ansible --version
NB : There is a waring on the terminal output, Ansible 2.12 and later versions require Python 3.8 or newer. Your system has Python 3.6.8, to resolve this, you should update your Python version to at least 3.8.
Also, the cryptography library is warning that Python 3.6 is no longer supported. Updating Python should also address this warning.
Here are the steps to update Python :
Install python 3.8
sudo yum install -y python38
Update alternatives
sudo alternatives --set python /usr/bin/python3.8
Update pip for the new Python version
sudo /usr/bin/python3.8 -m pip install --upgrade pip
Reinstall Ansible for the new Python version
sudo /usr/bin/python3.8 -m pip install --upgrade ansible==4.8.0
Verify the installation
ansible --version
Make Ansible binary globally available for all users
You need to make sure that the directory where Ansible binaries are installed is in the system's PATH. The location might vary based on your system and Python version, but it's often in
/usr/local/bin
.To check where Ansible is installed, you can use.
which ansible
If it's not in a directory already in the system's PATH, you can add it by adding the following line to the appropriate shell configuration file like ~/.bashrc
, ~/.bash_profile
, or ~/.zshrc
.
export PATH=$PATH:/path/to/ansible/bin/directory
Replace
/path/to/ansible/bin/directory
with the actual path where Ansible is installed.After making changes to the shell configuration file, reload it.
source ~/.bashrc