Ansible - Uninstall Ansible on Linux using pip
by
Jeremy Canfield |
Updated: December 04 2022
| Ansible articles
The pip3 show command can be used to determine if Ansible is installed.
AVOID TROUBLE
There are 3 versions of pip
- pip is used for Python version 2.6 and below
- pip2 is used for Python version 2.7 and above
- pip3 is used for Python version 3
For example, the /usr/bin/pip command (or just pip) would be used for Python version 2.6 and below.
pip3 show ansible
Something like this should be returned. In this example, Ansible version 2.9.12 is installed.
Name: ansible
Version: 2.9.12
Summary: Radically simple IT automation
Home-page: https://ansible.com/
Author: Ansible, Inc.
Author-email: info@ansible.com
License: GPLv3+
Location: /root/.local/lib/python3.6/site-packages
Requires: jinja2, PyYAML, cryptography
The hash command caches the paths to commands, and if a command is relocated then bash will not pick it up unless that cache is cleared. Issue the following command to clear Ansible from the cache.
hash -d ansible
Use pip3 to uninstall ansible.
pip3 uninstall ansible
Something like this should be returned.
Found existing installation: ansible 2.9.12
Uninstalling ansible-2.9.12:
Would remove:
/usr/local/bin/ansible
/usr/local/bin/ansible-config
/usr/local/bin/ansible-connection
/usr/local/bin/ansible-console
/usr/local/bin/ansible-doc
/usr/local/bin/ansible-galaxy
/usr/local/bin/ansible-inventory
/usr/local/bin/ansible-playbook
/usr/local/bin/ansible-pull
/usr/local/bin/ansible-test
/usr/local/bin/ansible-vault
/usr/local/lib/python3.6/site-packages/ansible-2.9.12-py3.6.egg-info
/usr/local/lib/python3.6/site-packages/ansible/*
/usr/local/lib/python3.6/site-packages/ansible_test/*
Would not remove (might be manually added):
/usr/local/lib/python3.6/site-packages/ansible_test/_data/injector/ansible-inventory
Proceed (y/n)? y
Successfully uninstalled ansible-2.9.12
The pip3 show command should now return something like this.
WARNING: Package(s) not found: ansible
Did you find this article helpful?
If so, consider buying me a coffee over at
Comments
August 01 2022 by Lavanya hema
Perfect solution. saved lot of time