During the weekly meeting, the Nautilus DevOps team discussed about the automation and configuration management solutions that they want to implement. While considering several options, the team has decided to go with Ansible for now due to its simple setup and minimal pre-requisites. The team wanted to start testing using Ansible, so they have decided to use jump host as an Ansible controller to test different kind of tasks on 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.
Why Ansible
Ansible stands out among automation solutions for several reasons. It requires no agents to be installed on managed nodes, using SSH for communication. The playbooks are written in YAML, making them human-readable and easy to learn. The setup is simple with minimal prerequisites, allowing teams to start testing quickly. Ansible also scales from managing a few servers to thousands of systems with the same simple approach.
Understanding the Ansible Installation Approach
There are several ways to install Ansible, including using the system package manager, installing from source, or using pip. Using pip3 to install Ansible provides more control over the version being installed and ensures compatibility with specific requirements.
Ansible 4.8.0 is a specific version that includes Ansible Core 2.11.x. This version offers stability and feature completeness suitable for production environments.
Prerequisites
Before beginning the installation, the following prerequisites must be met. The system should be running a Linux distribution with Python 3 installed. The user performing the installation should have sudo privileges. An active internet connection is required for downloading packages and dependencies. The pip3 package manager should be available or installable.
Step-by-Step Installation Process
Step 1: Connect to the Jump Host
Access the Jump host using SSH with the appropriate user credentials.
ssh thor@jump-host
Step 2: Install or Verify pip3
If pip3 is not already installed on the system, install it using the system package manager.
sudo yum install -y python3-pip
The output should confirm that pip3 is installed or already available.
Step 3: Install Ansible 4.8.0
Use pip3 to install the specific version of Ansible.
sudo pip3 install ansible==4.8.0
This command downloads and installs Ansible along with its dependencies, including ansible-core, jinja2, PyYAML, cryptography, and packaging.
Step 4: Verify the Installation
After the installation completes, verify that Ansible is installed correctly and is available globally.
ansible --version
which ansible
ansible --version | head -1
Installation Output
When the installation runs successfully, the output should show the download and installation progress of Ansible and its dependencies. All packages will be collected and installed, with the final success message confirming the installation of ansible version 4.8.0.
The verification should display Ansible core version information, the Python module location, the executable location, and the Python version being used.
Verification Commands
Several commands can be used to verify the installation. The ansible --version command displays detailed version information. The which ansible command confirms the binary location. The ansible --version | head -1 command shows just the version line.
Testing basic functionality can be done with the ping module on localhost.
ansible localhost -m ping
Troubleshooting Common Issues
When the pip3 command is not found, install python3-pip using the system package manager. If permission errors occur, ensure sudo is used for installation. When the ansible command is not found after installation, check if /usr/local/bin is in the system PATH. For version mismatches, uninstall and reinstall the specific version. Dependency issues can be resolved by upgrading pip and setuptools before installation.
Summary
The ansible package version 4.8.0 has been successfully installed on the Jump host. The binary is located at /usr/local/bin/ansible and is available globally to all users on the system. The installation was performed using pip3, ensuring version control and compatibility.
Top comments (0)