Snap install successful but "An exception occurred"

I have install_packages.yml reading

- hosts: ubuntu_desktops
  any_errors_fatal: false
  become: true
  tasks:
  - name: Install Zotero.
    community.general.snap:
      name: zotero-snap

When I run ansible-playbook -i inventory.yml install_packages.yml
the taks Install Zotero. fails with the following error message:

An exception occurred during task execution. 
To see the full traceback, use -vvv. 
The error was: 
ansible_collections.community.general.plugins.module_utils.mh.exceptions.ModuleHelperException
fatal: [mtbiberkopf]: 
FAILED! => {"changed": false, "channel": null, "classic": false, 
  "cmd": "['state', 'classic', 'channel', 'zotero-snap']",
  "msg": "Ooops! Snap installation failed while executing '['state', 'classic', 'channel', 'zotero-snap']', please examine logs and error output for more details.", 
  "output": {"channel": null, "classic": false, 
    "cmd": "['state', 'classic', 'channel', 'zotero-snap']", 
    "snaps_installed": ["zotero-snap"]}, 
    "snaps_installed": ["zotero-snap"], 
    "vars": {"channel": null, "classic": false, "cmd": "['state', 'classic', 'channel', 'zotero-snap']", "snaps_installed": ["zotero-snap"]}}

However, the sofware does actually get installed despite what the error message says. When I log into that machine and run sudo snap install zotero-snap I get
snap "zotero-snap" is already installed, see 'snap help refresh'.

What am I doing wrong?

That doesn’t look like you’re doing anything wrong. In fact, that looks like you probably ran into Issue #7130 or Issue #7265.

From what I can tell, this was partially fixed in community.general:7.3.0, and fully fixed in 7.5.0. You probably just need to upgrade your collection. If you’re already using a newer version than 7.5.0, then you need to submit a new issue to them at Github.

1 Like

Yes, after a

ansible-galaxy collection install community.general --upgrade

the playbook ran through flawlessly. Thanks!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.