How to use / install Ansible collections - Content has no field named 'owner' and sorry, community.kubernetes was not found

Viewed 11168

I noticed more and more stuff is distributed using Ansible collections. It looks great but it is unclear to me how Ansible collections are used / should be used.

For example when I try

ansible-galaxy collection install community.kubernetes

It just displays a warning and error and does nothing

[user:~] 5 $ ansible-galaxy collection install community.kubernetes
- downloading role 'collection', owned by   [WARNING]: - collection was NOT installed successfully: Content has no field named 'owner'

ERROR! - you can use --ignore-errors to skip failed roles and finish
processing the list.

Ignoring errors doesn't help, it still won't install

[user:~] $ ansible-galaxy collection install community.kubernetes --ignore-errors
- downloading role 'collection', owned by 
 [WARNING]: - collection was NOT installed successfully: Content has no field named 'owner'

- downloading role 'kubernetes', owned by community
 [WARNING]: - community.kubernetes was NOT installed successfully: - sorry, community.kubernetes was not found on
https://galaxy.ansible.com.

[user:~] $ 
2 Answers

Collections require Ansible 2.9.*

You'll need a newer version of Ansible to get that feature. (v2.9 or above).

$ ansible --version
ansible 2.8.6        # This version doesn't support collections!

However, the upgrade process can be a little difficult. You may see this error:

### ERROR ###

Upgrading directly from ansible-2.9 or less to ansible-2.10 or greater with pip is
known to cause problems.  Please uninstall the old version found at:

/home/username/.local/lib/python3.8/site-packages/ansible/__init__.py

and install the new version:

    pip uninstall ansible
    pip install ansible

If you have a broken installation, perhaps because ansible-base was installed before
ansible was upgraded, try this to resolve it:

    pip install --force-reinstall ansible ansible-base

So, it's probably a good idea to follow those commands:

pip uninstall ansible
pip install ansible

# Then check the version, and install your collection
ansible --version
ansible-galaxy collection install community.mycollectionname
Related