Ansible-dev-environment fails in container

branic
Mon, 13 Jan 2025 21:54:52 +0000
Get Help

I created a new collection using the VSCode Ansible extension “New collection project” functionality. As part of the collection project creation a devcontainer configuration was created (yay), but when trying to use the devcontrainer I get the below errors from ade.

$ ade install -e .
   Error: Collections found in /usr/share/ansible/collections
    Hint: Run `sudo rm -rf /usr/share/ansible/collections` to remove them.
   Error: Unable to use user site packages directory: /root/.local/lib/python3.13/site-packages, please activate or specify a
          virtual environment
    Hint: Use `--venv <directory>` to specify a virtual environment or enable an existing one.
Critical: The development environment is not isolated, please resolve the above errors.

ansible-galaxy shows that there are collections installed:

$ ansible-galaxy collection list

# /usr/share/ansible/collections/ansible_collections
Collection        Version
----------------- -------
ansible.netcommon 7.1.0
ansible.posix     2.0.0
ansible.scm       3.0.0
ansible.utils     5.1.2

The container image that is specified in the .devcontainer/podman/devcontainer.json file is ghcr.io/ansible/community-ansible-dev-tools:latest.

Is this ade designed to be able to work inside a devcontainer? Is there a different community image that doesn’t contain any pre-installed collections or do I need to build my own image?

5 posts - 3 participants