-
Notifications
You must be signed in to change notification settings - Fork 664
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
dependency step installs roles to user's roles path, not in ephemeral directory #4109
Comments
molecule 5.1.0 looks OK:
|
Looks related to #4015 |
While this issue still has not been fixed, what I've found is I am able to update the provisioner YAML in molecule.yml: provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: $MOLECULE_EPHEMERAL_DIRECTORY/roles:${HOME}/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:$MOLECULE_PROJECT_DIRECTORY/roles The last item in the list there What's confusing is that according to Molecule's own docs @ https://ansible.readthedocs.io/projects/molecule/configuration/#molecule.provisioner.ansible.Ansible there's text that reads:
However, when running Molecule without override ANSIBLE_ROLES_PATH, the default that Molecule seems to set is:
I am running Molecule in a Docker container with my role project in the /svc directory. So it would seem what Molecule is setting is This differs from the docs in that it does not add $runtime_cache_dir/roles or $project_directory/../ I'm not even sure what In the end, instead of doing weird hacks like this, can we just go back to Molecule installing role dependencies for roles in the ~/.ansible/roles like it used to? Edit: While I'm in here... two other things... Installing 3rd party roles into a /roles subdirectory in your project also causes ansible-lint to lint those dependencies, which is not ideal. I end up having to ignore anything in /roles but requirements.yml in my .gitignore like:
And then ansible-lint will ignore dependencies as well as me/other devs not accidentally checking dependencies into the role project. Second, if the role/ directory doesn't exist, Molecule will install the dependent role into the proper or ~/.ansible/roles location. But for us, as we use AWX/Ansible Tower/Ansible Automation Platform, when my role is part of a playbook, AWX will look to my role's roles/requirements.yml to pull down transitive dependencies for my role. afaik there's no other way to do this |
This works for you even with the default prerun task that installs dependencies? It's only later (eg when running the create task) where molecule-loaded variables start showing up. |
Prerequisites
pip check
does not report any conflictsEnvironment
What happened
Hello. After update from molecule 4 to molecule 6 I mentioned that molecule now tries to install dependencies into user's roles directory, not in ephemeral directory. I tried to investigate this problem by running molecule in debug mode, and I couldn't see any debug messages in output (ANSIBLE_* and MOLECULE_* environment variables):
I think it can be related to this PR #4047
Reproducing example
No response
The text was updated successfully, but these errors were encountered: