Install Ansible in Ubuntu 18.04 LTS with pip3

Ansible is centrazied configuration management tool and it is agent less. It connects with remote linux/unix client on ssh port and with windows on WinRM. We will learn to install Ansible by using pip3 on Ubuntu 18.04 LTS. The installation pretty much easy.

ansible
In this post, we will cover both installing ansible for particular user and all users of system.

Install Ansible using pip3 in Ubuntu 18.04 LTS

1. Login with super user account and run the command to install pip3

sudo apt install python3-pip

2. It is good to install the ansible in user space. Because when we install Ansible it is shipped with many python modules and dependencies, so it won’t affect system wide. Some geeks also prefer to install ansible in python vitualenv.

pip3 install ansible --user

3. Now you have to update the environment PATH variable for ansible commands. Update the .bashrc file and add the following lines.

vi ~/.bashrc
export PATH=$PATH:$HOME/.local/bin 

4. Now run the below command to apply the changes done in .bashrc file.

source .bashrc

5. Now check the ansible command path.

which ansible

Now the ansible is installed in your system.

If you want to install ansible and make it available to all user. You have to install pip3 as described in Step 1 and followed by command sudo pip3 install ansible

Note: We have selected the Ubuntu 18.04 LTS because it has python3 available.Hence, pip3 is easily available.