简体   繁体   中英

How to cleanly uninstall ansible

Running debian jessie

I installed Ansible using the following procedure:

apt-get update
sudo apt-get install python-yaml python-pip python-jinja2 python-paramiko pip
git clone https://github.com/ansible/ansible.git
cd ansible
git submodule update --init --recursive
sudo make install 

Is there a way to cleanly uninstall Ansible that does not involve sifting through my directory tree and deleting?

The aim is to reinstall Ansible version 1.9 instead of the latest 2.1.0

There is a directory list in the source code repo telling you which directories ( and files ) are created. This is used to build the .deb package, but you can easily use it the other way around:

packaging/debian/ansible.dirs

if you have installed on redhat centos based systems you can do below to uninstall ansible cleanly and similar command for ubuntu debian based systems

rpm -qa | grep ansible | xargs rpm -e

rpm -qa | grep -i epel | xargs rpm -e

else yum remove ansible

Your best bet is to install checkinstall , run the install again under checkinstalls control, and then use dpkg to remove things.

https://wiki.debian.org/CheckInstall

I had built ansible 2.1.1 from source then wanted to downgrade to 2.1.0 using yum. The trick i learned was to go to /lib/python2.7/site-packages and deleting the ansible-2.1.1.0-py2.7.egg-info directory. In my case, using yum properly added files to /etc/ansible and /usr/bin, but as long as the old (newer version number) egg was there, then ansible --version continued to show the newer version number.

As I see you cloned ansible from git. Try to remove ansible folder, but first, go to cloned folder and write

make uninstall

then

cd ..
rm -r ansible_folder

and dependent folders, files for example '/etc/ansible' folder.

After removing ansible using dnf remove ansible uninstall python and reinstall ansible it will show the newer version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM