Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't resolve module/action 'community.docker.docker_container' #326

Open
anarion80 opened this issue Feb 24, 2024 · 5 comments
Open

Comments

@anarion80
Copy link

I've been running the action for a while now, and recently (couple months?) is keeps failing with the following error:

  ERROR! couldn't resolve module/action 'community.docker.docker_container'. This often indicates a misspelling, missing collection, or incorrect module path.
  
  The error appears to be in '/app/.venv/lib/python3.11/site-packages/molecule_plugins/docker/playbooks/destroy.yml': line 15, column 7, but may
  be elsewhere in the file depending on the exact syntax problem.
  
  The offending line appears to be:
  
  
      - name: Destroy molecule instance(s)
        ^ here
  CRITICAL Ansible return code was 4, command was: ansible-playbook --diff --inventory /github/home/.cache/molecule/authelia/default/inventory --skip-tags molecule-notest,notest /app/.venv/lib/python3.11/site-packages/molecule_plugins/docker/playbooks/destroy.yml
  WARNING  An error occurred during the test sequence action: 'destroy'. Cleaning up.

So it's as if Ansible within the action container can't see the module. I'm not the expert in dependency management here, but I can see ansible-core in the poetry.lock file and I can't see this community module added anywhere to this "minimalist language and runtime package" that ansible-core is.

One other github molecule action seems to be requiring the full "ansible" package:
https://github.com/robertdebock/docker-github-action-molecule/blob/master/requirements.txt

So is this a bug in molecule-action? If not, how else can I add comunity.docker.docker_container to my tests, in general, not to each role?

@gofrolist
Copy link
Owner

Can you provide me a link to your github actions?
I will try to reproduce

@anarion80
Copy link
Author

@gofrolist
Copy link
Owner

These ansible collections should be installed in a prerun step using requirements.yml file but because there is a specific folder structure you're using and option molecule_working_dir: ${{ matrix.role }} action goes into matrix.role folder and can't find requirements.yml and didn't install ansible collections.
I tried to specify path to this file but unfortunately it didn't work

    dependency:
      name: galaxy
      options:
        role-file: ../../requirements.yml

As a workaround you can create a symlink of requirements.yml in every roles folder
I created a PR as example for you anarion80/ansible-nas#110

@anarion80
Copy link
Author

Thanks! It seems to be working with this workaround: https://github.com/anarion80/ansible-nas/actions/runs/8139600112 (although I need to now fix all the neglected individual tests).

So although I was hoping for your action to just include the community module(s) or full ansible inside, I can take this and you can close the issue.

@dbrennand
Copy link

dbrennand commented Jun 4, 2024

I just ran into this problem in a CI run for one of my roles: https://github.com/dbrennand/ansible-role-autorestic/actions/runs/9362630720/job/25771742820

The issue for me was because I modified the default molecule test_sequence in dbrennand/ansible-role-autorestic@b652325

It seems that the dependency stage seems to install the community.docker collection?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants