Ansible 为 root 用户和非 root 用户显示不同的版本

Ansible 为 root 用户和非 root 用户显示不同的版本

我需要使用旧版本的 Ansible (2.9)。我使用添加了 repo add-apt-repository ppa:ansible/ansible-2.9。当我ansible --version以 root 身份运行时,我得到:

ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]

但是,当我以普通用户身份运行相同的命令时,我得到:

ansible 2.10.3
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/christopher/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/christopher/.local/lib/python3.8/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]

我有不知道发生了什么。我现在甚至无法使用 Ansible,因为每个剧本都会崩溃,因为它无法识别诸如 之类的模块package。我在哪里可以找到这个 2.10.3 版本并摆脱它!?

答案1

pip3 list

成立ansible-base 2.10.3

pip3 uninstall ansible-base

在我和 sudo 上都运行过ansible --version。现在都是 2.9.6

ansible --version
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]

以 root 身份

ansible --version    
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]

相关内容