Ansible & Python Installation on to an Ubuntu Box

Note:The lines starting with “$” are the unix commands that needs to be executed in the Ubuntu Box

Here we are going to see how to install Ansible on to a Ubuntu Box(16.04) will work for Ubuntu 18.x ,19.x and 20.x as well.

PreRequisites:

Make sure you have the right Python Version

Follow the steps below or simply download and execute the file ./py.sh from https://github.com/rangapv/pyUpgrade.git repo to upgrade the python version/new python installation and jump to the section Next Update the libraries down below for Ansible Install.

If the output is python2.* then do this

Then

Then Check if the upgrade was successful with this command

So now you have both python version 2 and 3 installed. Do the following so that the compiler selects the Python 3 for the Run time

Let’s install pip the package manager for python

Let’s upgrade the pip package to make double sure …

Next Update the libraries:

The following libraries are needed in case it asks for permission just type “y”

Now we are needing to disable the SELinux status

To check if SELinux is disabled

The output should say as :

or

Bingo !

Back to Ansible Installs:

Execute the following command one after another for Ansible to be installed in the Ubuntu Box

Check if the Installation is successful…

Sample output…

To Check if Ansible works …

Sample Output…

You are all set to use Ansible now on Ubuntu!

Works on Devops in Startups, reach me @rangapv on twitter or email: rangapv@gmail.com