Replies: 1 comment
-
I played with molecule and it looks like this patch does what I want: --- ansible.py_orig 2023-02-07 14:23:55.353889956 +0500
+++ ansible.py 2023-02-07 14:20:48.539619778 +0500
@@ -455,15 +455,6 @@
collection_indicator, 1
)
collections_path_list.append(util.abs_path(collection_path))
- collections_path_list.extend(
- [
- util.abs_path(
- os.path.join(os.path.expanduser("~"), ".ansible/collections")
- ),
- "/usr/share/ansible/collections",
- "/etc/ansible/collections",
- ]
- )
if os.environ.get("ANSIBLE_COLLECTIONS_PATH", ""):
collections_path_list.extend(
@@ -482,9 +473,6 @@
os.path.join(self._config.scenario.ephemeral_directory, "roles")
),
util.abs_path(os.path.join(self._config.project_directory, os.path.pardir)),
- util.abs_path(os.path.join(os.path.expanduser("~"), ".ansible", "roles")),
- "/usr/share/ansible/roles",
- "/etc/ansible/roles",
]
if os.environ.get("ANSIBLE_ROLES_PATH", ""): |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. Molecule set ANSIBLE_COLLECTIONS_PATH and ANSIBLE_ROLES_PATH vars quite wide - it adds user's home and system-wide directories:
It can lead to tricky situation. I think it would be useful to have ability to completely isolate these paths to self._config.scenario.config.runtime.cache_dir or self._config.scenario.ephemeral_directory (
provisioner/ansible.py
).Use case: I have a role tested with molecule. After some changes, this role now call
ansible.posix.authorized_keys
fromansible.posix
collection. On my machine it works, but on CI/CD it fails. After some investigation I found out, that I have this collection installed to my home directory (~/.ansible/collections
), because some other local playbooks uses it, and molecule uses this collection from there.I know, it's my fault - I should have added this collection to requirements.yml. But I think, it would be better if molecule have failed in such cases with error like "cannon find ansible.posix collection" instead of using global-installed collection.
Beta Was this translation helpful? Give feedback.
All reactions