Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible no longer works

I have been learning Ansible on Windows 10 through WSL (using Pengwin, a Debian-based Linux) and it's been working fine up until last night. This morning, it's as though it doesn't exist any more:

❯ ansible
Traceback (most recent call last):
  File "/usr/bin/ansible", line 34, in <module>
    from ansible import context
ModuleNotFoundError: No module named 'ansible'

Literally nothing has changed since last night. Even my computer has remained on. The only difference is that I had logged out of my terminal program.

I tried running pengwin-setup to re-install Ansible, but the issue persists.

Finally, I tried installing it via the instructions on Ansible's own site. However, things got even worse:

❯ 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.

Now I'm out of options. How can I get Ansible running again?

like image 397
Sturm Avatar asked May 20 '20 17:05

Sturm


1 Answers

Your issue is coming from the fact that you are using the instructions to install Ansible on an Ubuntu distribution, when, as you stated it, Pengwin is a Debian based one.

So you should use the chapter on how to install Ansible on Debian and not how to install Ansible on Ubuntu.

Better, still, because Pengwin is a very particular distribution, since it is a WSL one, you might want to try the installation via 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

https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-with-pip

like image 99
β.εηοιτ.βε Avatar answered Nov 03 '22 18:11

β.εηοιτ.βε