Molecule: `roles-path` for ansible-galaxy dependency cannot find paths relative to scenario directory

Created on 12 Oct 2018  路  4Comments  路  Source: ansible-community/molecule

Issue Type

  • Bug report

Molecule and Ansible details

ansible --version
ansible 2.6.5
molecule --version
molecule, version 2.18.1

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip

Desired Behavior

I'd like to share the requirements.yml file across scenarios similar to what's documented for sharing other resources. I would think specifying a relative roles-file would work.

dependency:
  name: galaxy
  options:
    roles-path: ../resources/requirements.yml

Actual Behaviour (Bug report only)

Dependency is skipped because the roles file is not found. It looks like the path is relative to the working directory rather than the scenario directory. e.g. this works:

dependency:
  name: galaxy
  options:
    roles-path: molecule/resources/requirements.yml

Most helpful comment

It's not just relative paths that don't work; from what I can tell specifying this option doesn't work at all. Even the following doesn't work:

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

Molecule still reports "Skipping, missing the requirements file." Removing the config entirely is the only thing that works.

All 4 comments

Yes this can be a pain, specially because when you are configuring ansible options, they are relative to the Scenario, so it becomes very complicated to have paths where one goes from root folder up to the scenarios, and others relative to the scenario. Consistency is the key.

It's not just relative paths that don't work; from what I can tell specifying this option doesn't work at all. Even the following doesn't work:

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

Molecule still reports "Skipping, missing the requirements file." Removing the config entirely is the only thing that works.

Scratch my last, it does work if you specify the path relative to the base role directory. I should try reading the issue description ;) Still would be nice if this worked like other paths in the molecule.yml file.

I mean not your entire last @twbecker: Doing the role file like that doesn't work.

I would have thought that the molecule/<scenario>/requirements.yml would have been a default location that it would check first, too, _without_ specifying one (similar to how prepare.yml works, etc.)

At least after this issue I can get things working by doing this:

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

Just wish I didn't have to when it's in the scenario folder...

Was this page helpful?
0 / 5 - 0 ratings