ansible-community / molecule-docker

🚧 Assimilated into molecule-plugins
https://github.com/ansible-community/molecule-plugins
MIT License
77 stars 39 forks source link

molecule_docker could not resolve module/action "docker_login" #38

Closed Nightreaver closed 3 years ago

Nightreaver commented 3 years ago

Hello,

i have recently updated my ansible/molecule setup and now im hitting a weird error which it seems i cannot resolve

INFO     docker scenario test matrix: dependency, create, prepare, converge
INFO     Running docker > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running docker > create
INFO     Sanity checks: 'docker'
ERROR! couldn't resolve module/action 'docker_login'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/opt/venv/lib/python3.8/site-packages/molecule_docker/playbooks/create.yml': line 11, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
    - name: Log into a Docker registry
      ^ here

molecule version:

❯ molecule --version
molecule 3.2.3 using python 3.8 
    ansible:2.10.5
    azure:0.5.0 from molecule_azure
    delegated:3.2.3 from molecule
    docker:0.2.4 from molecule_docker
    ec2:0.3 from molecule_ec2
    gce:0.2 from molecule_gce
    vmware:0.3.3 from molecule_vmware
❯ ansible --version
ansible 2.10.5
  config file = None
  configured module search path = ['/home/dockeruser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/venv/lib/python3.8/site-packages/ansible
  executable location = /opt/venv/bin/ansible
  python version = 3.8.7 (default, Feb  4 2021, 01:39:45) [GCC 10.2.1 20201203]

ansible collections installed

        community.general:=1.3.6 
        ansible.windows:=1.4.0 
        community.windows:=1.3.0 
        azure.azcollection:=1.4.0 
        community.azure:=1.0.0 
        google.cloud:=1.0.1 
        community.google:=1.0.0 
        amazon.aws:=1.4.0 
        community.aws:=1.3.0 
        kubernetes.core:=1.1.1 
        community.vmware:=1.7.0 
        community.docker:=1.2.2 

i also tried community.general 2.1.1 with the same results.

My scenario does not contain a create.yml , only molecule.yml, converge.yml

Any ideas why I suddenly get this error?

tadeboro commented 3 years ago

How did you install your collections? If they are not in one of the default locations, Ansible might have trouble finding them when executed under molecule.

Nightreaver commented 3 years ago

Well it was working earlier - before i did update ansible+molecule and everything. I didnt change any path so it should technically just be the same, no?

tadeboro commented 3 years ago

Well it was working earlier - before i did update ansible+molecule and everything. I didnt change any path so it should technically just be the same, no?

Well, recent versions of molecule started isolating things a bit more during testing. And if I remember correctly, limiting what directories are searched for installed collections is one of the things molecule plays with.

Nightreaver commented 3 years ago

TThey have been installed with ansible-galaxy collection install --collections-path /usr/share/ansible/ansible_collections ... and you say this is causing issues?

Nightreaver commented 3 years ago

thanks for the hint, it seems you are right. I ran molecule with --debug and got
ANSIBLE_COLLECTIONS_PATH: /home/dockeruser/.cache/molecule/enable_ntp_client/docker/collections:/home/dockeruser/.ansible/collections:/usr/share/ansible/collections:/etc/ansible/collections
seems thats the path I set in ansible is not recognized ( it was /usr/share/ansible/ansible_collections ) so i changed it to just /usr/share/ansible/collections and it works again!

So thanks a lot

KentBrockman commented 2 years ago

For others who may stumble across this issue:

An obvious thing to check is you have the collection installed. You can install it with: ansible-galaxy collection install community.docker