Loading...

Watch: How to install Ansible with PIP - Ansible install

How to install Ansible with PIP - the Python package manager.

How to install Ansible with PIP, the Python package manager?

Today we're going to talk about how to use the up-to-date version of Ansible in Linux and macOS using PIP.

I'm Luca Berton and welcome to today's episode of Ansible Pilot

How to install Ansible with PIP

Today we're talking about How to install Ansible with PIP.

PIP is the Python package manager and is going to take care of all the processes and manage the necessary dependency. It takes care of the download and installs process of packages directly from PyPI. PIP is designed to be OS-independent.

It could be a solution for developers that always want the latest up-to-date release.

The alternative approach is to use the Operating System specific Package Manager.

For example for Linux yum, DNF, and apt and for macOS Homebrew.

This second approach put more emphasis on stability so the latest release could be not available.

So if you really need the latest release of Ansible I'd suggest you use PIP.

Demo install Ansible with PIP

Demo time!

Let me Playbooknstrate to you how to install the latest of Ansible with PIP, the Python package manager.

code PIP user

  • install-pip-user.sh

``bash

#!/bin/bash

python3 -m pip install --upgrade -user pip

python3 -m pip install --user ansible

install-pip-global.sh

`

code PIP global

  • install-pip-global.sh

`bash

#!/bin/bash

python3 -m pip install --upgrade pip

python3 -m pip install ansible

`

  • Execution

``bash

root@demo:/home/devops# python3 -m pip install --upgrade pip

Requirement already satisfied: pip in /usr/lib/python3/dist-packages (20.3.4)

Collecting pip

Downloading pip-22.1.2-py3-none-any.whl (2.1 MB)

|████████████████████████████████| 2.1 MB 1.4 MB/s

Installing collected packages: pip

Attempting uninstall: pip

Found existing installation: pip 20.3.4

Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr

Can't uninstall 'pip'. No files were found to uninstall.

Successfully installed pip-22.1.2

root@demo:/home/devops# python3 -m pip install ansible

Collecting ansible

Downloading ansible-6.1.0-py3-none-any.whl (40.5 MB)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.5/40.5 MB 795.8 kB/s eta 0:00:00

Collecting ansible-core~=2.13.1

Downloading ansible_core-2.13.1-py3-none-any.whl (2.1 MB)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 715.5 kB/s eta 0:00:00

Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (from ansible-core~=2.13.1->ansi

Read the full tutorial: How to install Ansible with PIP - Ansible install