~/.ansible/collections/ansible_collections/ is the default location where ansible-galaxy collection install command install to.
And /usr/lib/python3/dist-packages/ansible_collections/ is the location where installed collections by ansible community package (ansible-core and collections).
~/.ansible/collections/ansible_collections/ is the preferred search target for the collection.
At some point I installed the ansible package with the apt install ansible command.
On another host I executed once apt install ansible and got an Ansible version 2.10.8. Since I wanted a newer one, I uninstalled the ansible package and installed the ansible-core package with apt install ansible-core command, which got me Ansible [core 2.16.4].
So I am assuming that I did the same on the laptop, as well and that the /usr/lib/python3/dist-packages/ansible_collections is a leftover from executing the apt install ansible command. What do you think? Does this make sense?
Any idea how to properly remove the /usr/lib/python3/dist-packages/ansible_collections directory?
as well and that the /usr/lib/python3/dist-packages/ansible_collections is a leftover from executing the apt install ansible command.
I think yes.
If you don’t need ansible(-base) 2.10.8 installed by apt install ansible, you can remove /usr/lib/python3/dist-packages/ansible and /usr/lib/python3/dist-packages/ansible_collections diretory by apt remove ansible.
Due to some experience with another host, I thought that the ansible and ansible-core packages could not be installed simulatenously. It turns out that, actually, these two were installed at the same time on my laptop, hence the two ansible_collections directories.
ansible >= 3.0.0 and ansible-core can be installed at the same time. Actually if you install ansible >= 3.0.0, it will always install ansible-core as a dependency.