DEV Community

Cover image for 8.Install Ansible
Thu Kha Kyawe
Thu Kha Kyawe

Posted on

8.Install Ansible

Lab Information

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.7.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.

Lab Solutions

🧭 Part 1: Lab Step-by-Step Guidelines

Objective

On the Jump Host, install:

Ansible version 4.7.0

Using pip3 only, and ensure the ansible command is globally available for all users.

1️⃣ Login to Jump Host

ssh thor@jump_host.stratos.xfusioncorp.com
Enter fullscreen mode Exit fullscreen mode

Password:

mjolnir123

2️⃣ Switch to Root

Installing globally requires root privileges.

sudo -i
Enter fullscreen mode Exit fullscreen mode

3️⃣ Verify pip3 Exists

pip3 --version
Enter fullscreen mode Exit fullscreen mode

4️⃣ Install Ansible 4.7.0 Using pip3

pip3 install ansible==4.7.0
Enter fullscreen mode Exit fullscreen mode

This installs Ansible system-wide.

5️⃣ Verify Installation

ansible --version

find / -name ansible 2>/dev/null

# Create a global symlink and to make it available everywhere, run:

ln -s /usr/local/bin/ansible /usr/bin/ansible

ansible --version
Enter fullscreen mode Exit fullscreen mode

6️⃣ Confirm Global Access

Switch back to thor:

exit
Enter fullscreen mode Exit fullscreen mode

Run:

ansible --version
Enter fullscreen mode Exit fullscreen mode

If it prints the version, Ansible is globally accessible.


🧠 Part 2: Simple Explanation (Beginner Friendly)

What the lab is testing

This lab tests:

Skill Tool
Python package installation pip3
Infrastructure automation Ansible

What is Ansible?

Ansible is a configuration management and automation tool.

It allows you to run commands on multiple servers from one machine.

Example workflow:

Jump Host (Controller)

stapp01
stapp02
stapp03
stdb01

One command can configure all servers at once.

Why the Jump Host becomes the Controller

The lab states:

Jump host → Ansible controller

This means all automation commands will run from the jump host.

Why we use pip3

Ansible can be installed in two ways:

Method Example
OS package manager yum install ansible
Python package manager pip3 install ansible

The lab specifically requires:

pip3 only

So we must use:

pip3 install ansible==4.7.0
Why install globally

The lab requires:

All users should run ansible

Installing as root ensures the binary goes into:

/usr/local/bin/ansible

Which is available system-wide.


Resources & Next Steps
📦 Full Code Repository: KodeKloud Learning Labs
📖 More Deep Dives: Whispering Cloud Insights - Read other technical articles
💬 Join Discussion: DEV Community - Share your thoughts and questions
💼 Let's Connect: LinkedIn - I'd love to connect with you

Credits
• All labs are from: KodeKloud
• I sincerely appreciate your provision of these valuable resources.

Top comments (0)