Right now I have
---
- name: Install community.general collection
command: ansible-galaxy collection install community.general
changed_when: True
which works, but will report that something was changed on every run (changed_when: False has opposite problem) and I suspect that error handling will be poor.
When trying to install an existing collection from command line I get:
Based on this output and on the fact this does not raise an error, the following should meet your requirement as a first quick and dirty solution. You can enhance it for your specific needs: