Ansible 不再有效
Ansible no longer works
我一直在通过 WSL(使用基于 Debian 的 Pengwin Linux)在 Windows 10 上学习 Ansible,直到昨晚它一直运行良好。今天早上,它好像不存在了:
❯ ansible
Traceback (most recent call last):
File "/usr/bin/ansible", line 34, in <module>
from ansible import context
ModuleNotFoundError: No module named 'ansible'
从字面上看,自昨晚以来没有任何变化。甚至我的电脑也一直开着。唯一的区别是我退出了我的终端程序。
我尝试 运行 pengwin-setup
重新安装 Ansible,但问题仍然存在。
最后,我尝试按照 Ansible 自己网站上的说明进行安装。然而,事情变得更糟了:
❯ sudo apt install software-properties-common
[sudo] password for sturm:
Reading package lists... Done
Building dependency tree
Reading state information... Done
software-properties-common is already the newest version (0.96.20.2-2.1).
0 upgraded, 0 newly installed, 0 to remove and 85 not upgraded.
❯ sudo apt-add-repository --yes --update ppa:ansible/ansible
gpg: keybox '/tmp/tmpg2r1t8x7/pubring.gpg' created
gpg: /tmp/tmpg2r1t8x7/trustdb.gpg: trustdb created
gpg: key 93C4A3FD7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported
gpg: Total number processed: 1
gpg: imported: 1
gpg: no valid OpenPGP data found.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 688, in addkey_func
func(**kwargs)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 386, in add_key
return apsk.add_ppa_signing_key()
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 273, in add_ppa_signing_key
cleanup(tmp_keyring_dir)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 234, in cleanup
shutil.rmtree(tmp_keyring_dir)
File "/usr/lib/python3.8/shutil.py", line 715, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.8/shutil.py", line 672, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.8/shutil.py", line 670, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apt/cache.py", line 570, in update
res = self._cache.update(fetch_progress, slist,
apt_pkg.Error: E:The repository 'http://ppa.launchpad.net/ansible/ansible/ubuntu groovy Release' does not have a Release file.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 168, in <module>
if not sp.add_source_from_shortcut(shortcut, options.enable_source):
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 759, in add_source_from_shortcut
cache.update(sources_list=new_debsrc_entry.file)
File "/usr/lib/python3/dist-packages/apt/cache.py", line 573, in update
raise FetchFailedException(e)
apt.cache.FetchFailedException: E:The repository 'http://ppa.launchpad.net/ansible/ansible/ubuntu groovy Release' does not have a Release file.
现在我别无选择。我怎样才能再次获得 Ansible 运行?
您的问题是因为您使用说明在 Ubuntu 发行版上安装 Ansible,而正如您所说,Pengwin 是基于 Debian 的。
所以你应该使用 how to install Ansible on Debian and not how to install Ansible on Ubuntu 上的章节。
更好的是,因为 Pengwin 是一个非常特殊的发行版,因为它是一个 WSL 发行版,您可能想通过 pip
:
尝试安装
Ansible can be installed with pip
, the Python package manager. If
pip
isn’t already available on your system of Python, run the
following commands to install it:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py --user
Then install Ansible:
$ pip install --user ansible
我一直在通过 WSL(使用基于 Debian 的 Pengwin Linux)在 Windows 10 上学习 Ansible,直到昨晚它一直运行良好。今天早上,它好像不存在了:
❯ ansible
Traceback (most recent call last):
File "/usr/bin/ansible", line 34, in <module>
from ansible import context
ModuleNotFoundError: No module named 'ansible'
从字面上看,自昨晚以来没有任何变化。甚至我的电脑也一直开着。唯一的区别是我退出了我的终端程序。
我尝试 运行 pengwin-setup
重新安装 Ansible,但问题仍然存在。
最后,我尝试按照 Ansible 自己网站上的说明进行安装。然而,事情变得更糟了:
❯ sudo apt install software-properties-common
[sudo] password for sturm:
Reading package lists... Done
Building dependency tree
Reading state information... Done
software-properties-common is already the newest version (0.96.20.2-2.1).
0 upgraded, 0 newly installed, 0 to remove and 85 not upgraded.
❯ sudo apt-add-repository --yes --update ppa:ansible/ansible
gpg: keybox '/tmp/tmpg2r1t8x7/pubring.gpg' created
gpg: /tmp/tmpg2r1t8x7/trustdb.gpg: trustdb created
gpg: key 93C4A3FD7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported
gpg: Total number processed: 1
gpg: imported: 1
gpg: no valid OpenPGP data found.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 688, in addkey_func
func(**kwargs)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 386, in add_key
return apsk.add_ppa_signing_key()
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 273, in add_ppa_signing_key
cleanup(tmp_keyring_dir)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 234, in cleanup
shutil.rmtree(tmp_keyring_dir)
File "/usr/lib/python3.8/shutil.py", line 715, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.8/shutil.py", line 672, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.8/shutil.py", line 670, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apt/cache.py", line 570, in update
res = self._cache.update(fetch_progress, slist,
apt_pkg.Error: E:The repository 'http://ppa.launchpad.net/ansible/ansible/ubuntu groovy Release' does not have a Release file.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 168, in <module>
if not sp.add_source_from_shortcut(shortcut, options.enable_source):
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 759, in add_source_from_shortcut
cache.update(sources_list=new_debsrc_entry.file)
File "/usr/lib/python3/dist-packages/apt/cache.py", line 573, in update
raise FetchFailedException(e)
apt.cache.FetchFailedException: E:The repository 'http://ppa.launchpad.net/ansible/ansible/ubuntu groovy Release' does not have a Release file.
现在我别无选择。我怎样才能再次获得 Ansible 运行?
您的问题是因为您使用说明在 Ubuntu 发行版上安装 Ansible,而正如您所说,Pengwin 是基于 Debian 的。
所以你应该使用 how to install Ansible on Debian and not how to install Ansible on Ubuntu 上的章节。
更好的是,因为 Pengwin 是一个非常特殊的发行版,因为它是一个 WSL 发行版,您可能想通过 pip
:
Ansible can be installed with
pip
, the Python package manager. Ifpip
isn’t already available on your system of Python, run the following commands to install it:$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py $ python get-pip.py --user
Then install Ansible:
$ pip install --user ansible