Skip to content

ansible-galaxy dependencies installed but not found #1162

@bartmeuris

Description

@bartmeuris

Issue Type

  • Bug report

Molecule and Ansible details

ansible 2.4.3.0
  config file = None
  configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vagrant/.virtualenvs/ansible-python2/local/lib/python2.7/site-packages/ansible
  executable location = /home/vagrant/.virtualenvs/ansible-python2/bin/ansible
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]

molecule, version 2.8.2

Python 2.7.12
  • Molecule installation method: virtualenv + pip
  • Ansible installation method: virtualenv + pip

Desired Behaviour

Dependencies defined in/installed with the requirements.yml should be found.

I created a requirements.yml in the molecule/default/ folder of a role containing:

---
- src: geerlingguy.docker

When I run molecule converge, the dependency is correctly installed:

(ansible-python2) vagrant@vagrant:/ansible/roles/testrole$ molecule converge
--> Test matrix

└── default
    ├── dependency
    ├── create
    ├── prepare
    └── converge

--> Scenario: 'default'
--> Action: 'dependency'
    - changing role geerlingguy.docker from 2.1.0 to unspecified
    - downloading role 'docker', owned by geerlingguy
    - downloading role from https://github.com/geerlingguy/ansible-role-docker/archive/2.1.0.tar.gz
    - extracting geerlingguy.docker to /home/vagrant/.ansible/roles/geerlingguy.docker
    - geerlingguy.docker (2.1.0) was installed successfully
Dependency completed successfully.
...

Expected behavior would be that after this, the role would be found, and the converge step would succeed.

Actual Behaviour (Bug report only)

The issue seems to be that Molecule does not search the ${HOME}/.ansible/roles/ folder where ansible-galaxy installs them:

After installing the dependency correctly (to /home/vagrant/.ansible/roles/geerlingguy.docker), molecule fails to find the geerlingguy.docker role (in this example):

(ansible-python2) vagrant@vagrant:/ansible/roles/testrole$ molecule converge
...
    - geerlingguy.docker (2.1.0) was installed successfully
Dependency completed successfully.
--> Scenario: 'default'
--> Action: 'create'
Skipping, instances already created.
--> Scenario: 'default'
--> Action: 'prepare'
Skipping, instances already prepared.
--> Scenario: 'default'
--> Action: 'converge'
ERROR! the role 'geerlingguy.docker' was not found in /ansible/roles/testrole/molecule/default/roles:/ansible/roles/testrole/molecule/default/.molecule/roles:/ansible/roles:/ansible/roles:/ansible/roles/testrole/molecule/default

The error appears to have been in '/ansible/roles/docker/meta/main.yml': line 5, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

dependencies:
  - role: geerlingguy.docker
    ^ here

ERROR:
(ansible-python2) vagrant@vagrant:/ansible/roles/testrole$

It seems that at least in my environment, molecule doesn't provide the --roles-path to ansible-galaxy install, I would expect it to pass something like molecule/default/.molecule/roles - or another folder that molecule puts in the ANSIBLE_ROLES_PATH env var.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions