Skip to content
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

Modules from collections are not recognized when COLLECTIONS_PATH is set via env var #1263

Open
vicmunoz opened this issue Apr 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@vicmunoz
Copy link

Summary

TLDR: Modules from collections are not recognized (no definition found) when COLLECTIONS_PATH is set via environment variable.

  1. ansible.cfg does not have collections_path (https://docs.ansible.com/ansible/latest/reference_appendices/config.html#collections-paths) setting in file. However env var ANSIBLE_COLLECTIONS_PATH is set
Screenshot 2024-04-22 at 13 02 53

❯ ansible-config dump | grep COLLECTIONS_PATHS COLLECTIONS_PATHS(env: ANSIBLE_COLLECTIONS_PATH) = ['/Users/victor/Code/Sandbox/automation/.collections']

  1. ansible.cfg have collections_path setting in file. Works fine, modules are recognized.
Screenshot 2024-04-22 at 13 03 40

Extension version

v24.4.0

VS Code version

1.88.1

Ansible Version

❯ ansible --version
ansible [core 2.16.5]
  config file = /Users/victor/Code/Sandbox/automation/ansible.cfg
  configured module search path = ['/Users/victor/Code/Sandbox/automation/plugins/modules']
  ansible python module location = /Users/victor/Code/Sandbox/automation/.venv/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/victor/Code/Sandbox/automation/.collections
  executable location = /Users/victor/Code/Sandbox/automation/.venv/bin/ansible
  python version = 3.11.6 (main, Mar 24 2024, 10:42:30) [Clang 15.0.0 (clang-1500.3.9.4)] (/Users/victor/Code/Sandbox/automation/.venv/bin/python)
  jinja version = 3.1.3
  libyaml = True

OS / Environment

MACOS 14.4

Relevant log output

No response

@vicmunoz vicmunoz added bug Something isn't working new labels Apr 22, 2024
@audgirka audgirka removed the new label Apr 24, 2024
@vicmunoz
Copy link
Author

vicmunoz commented May 16, 2024

Similar behaviour is observed with ansible-lint validation. When using ANSIBLE_VAULT_IDENTITY and ANSIBLE_VAULT_IDENTITY_LIST with environment variables I get syntax errors:

Unexpected error code 1 from execution of: ansible-playbook -i localhost, --syntax-check site.sample.production.yml

internal-error: Unexpected error code 1 from execution of: ansible-playbook -i localhost, --syntax-check site.sample.production.yml

site.sample.production.yml:1 [WARNING]: Error getting vault password file (credentials): The vault password

However using settings vault_identity and vault_identity_list into ansible.cfg clear all above errors and all runs fine.

Issues that could be related:
ansible/ansible-lint#2404
ansible/ansible-lint#2443
ansible/ansible-lint#2889

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Roadmap
Development

No branches or pull requests

2 participants