gpt4 book ai didi

ansible - 如何在 Ubuntu 18.04 上完全删除 Ansible 2.8.3

转载 作者:行者123 更新时间:2023-12-04 16:27:21 33 4
gpt4 key购买 nike

在我的 Ubuntu 18.04 上,我安装了 Ansible 2.8.3。

[root:~] # ansible --version
ansible 2.8.3
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.15+ (default, Oct 7 2019, 17:39:04) [GCC 7.4.0]

我当然可以使用 apt 删除这个包

[root:~] # apt remove ansible
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
python-httplib2 python-jinja2 python-markupsafe python-paramiko python-pyasn1 python-yaml sshpass
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
ansible
0 upgraded, 0 newly installed, 1 to remove and 343 not upgraded.
After this operation, 58.0 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 317908 files and directories currently installed.)
Removing ansible (2.9.6-1ppa~bionic) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
[root:~] #

我可以安装不同的版本,例如 2.9.6

[root:~] # apt install ansible=2.9.6-1ppa~bionic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
ansible
0 upgraded, 1 newly installed, 0 to remove and 343 not upgraded.
Need to get 0 B/5,786 kB of archives.
After this operation, 58.0 MB of additional disk space will be used.
Selecting previously unselected package ansible.
(Reading database ... 311783 files and directories currently installed.)
Preparing to unpack .../ansible_2.9.6-1ppa~bionic_all.deb ...
Unpacking ansible (2.9.6-1ppa~bionic) ...
Setting up ansible (2.9.6-1ppa~bionic) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
[root:~] #

问题是安装2.9.6-1ppa~bionic只会带回2.8.3版本。

[root:~] # ansible --version
ansible 2.8.3
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.15+ (default, Oct 7 2019, 17:39:04) [GCC 7.4.0]
[root:~] #

所以结论一定是apt remove ansible 不会完全删除2.8.3。如果另一个 apt install ansible 被执行,这个版本仍然可以被激活。

有没有办法完全删除 Ansible 2.8.3?没有完全重新安装 Ubuntu 18.04?

顺便说一句,我使用官方 Ansible 存储库安装了 2.8.3

[root:~] # cat /etc/apt/sources.list.d/ansible.list 
deb "http://ppa.launchpad.net/ansible/ansible/ubuntu" bionic main
[root:~] #

使用 Chef BTW,我使用 Chef 管理我的所有系统。所以 Ansible 是使用 apt 和官方 Ansible 存储库安装的。

apt_repository 'ansible' do
uri 'ppa:ansible/ansible'
distribution node['lsb']['codename']
end
package ['ansible','python-pip']

最佳答案

就我而言,事实证明我已经通过 pip 安装了 ansible:

$ sudo apt remove ansible
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'ansible' is not installed, so not removed

$ ansible --version
ansible 2.3.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]

$ sudo pip uninstall --yes ansible
Uninstalling ansible-2.3.2.0:
Successfully uninstalled ansible-2.3.2.0

$ ansible --version
-bash: /usr/local/bin/ansible: No such file or directory

所以尝试通过 pip 卸载 ansible:

$ sudo pip uninstall --yes ansible

关于ansible - 如何在 Ubuntu 18.04 上完全删除 Ansible 2.8.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60834692/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com