user2514157
user2514157

Reputation: 681

Cannot list ansible collections

How can I list the collections installed in ansible?

According to the ansible documentation (https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#listing-collections), the collections installed in ansible can be listed with the following command:

ansible-galaxy collection list

Or, by also specifying the path (e.g., the default path given in the link above):
ansible-galaxy collection list -p "~/.ansible/collections"

However, both result in the following error:
ansible-galaxy collection list usage: ansible-galaxy collection [-h] COLLECTION_ACTION ... ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')

ansible --version
ansible 2.9.6

Upvotes: 1

Views: 8937

Answers (2)

Gonen
Gonen

Reputation: 4075

To help those stuck with Ansible 2.9 and older,
there is a very nice Python-script by Brian Coca -
see https://github.com/bcoca/std/blob/devel/list_collections.py

(have found this script mentioned in Ansible-Galaxy issue #2844 and Ansible issue #76497)

Upvotes: 3

flowerysong
flowerysong

Reputation: 2939

Upgrade to a version of Ansible that supports listing collections. Ansible 2.9 is ancient and only has limited collection support; if you refer to its documentation (https://docs.ansible.com/ansible/2.9/user_guide/collections_using.html) you will see that it does not include this section, while 2.10's documentation (https://docs.ansible.com/ansible/2.10/user_guide/collections_using.html#listing-collections) does.

Upvotes: 3

Related Questions