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

ansible-lint: "WARNING Unable to load module ... for options validation" #411

Open
irozet12 opened this issue Oct 7, 2024 · 0 comments · May be fixed by #412
Open

ansible-lint: "WARNING Unable to load module ... for options validation" #411

irozet12 opened this issue Oct 7, 2024 · 0 comments · May be fixed by #412
Labels
bug Something isn't working

Comments

@irozet12
Copy link

irozet12 commented Oct 7, 2024

Summary

The issue is found with ansible-lint, but I suggest the fix in ansible-compat, that is why I report it here. Similar issue: #2861

ansible-lint installs required collections, and then can't load modules from them, the following warnings are printed:

WARNING  Unable to load module cloud.terraform.terraform at main.yml:34 for options validation
WARNING  Unable to resolve FQCN for module cloud.terraform.terraform

When we run ansible-lint second time, when required collections are already installed, the warnings do not appear

Issue Type
  • Bug Report
OS / ENVIRONMENT
python -c "import ansible_compat; print(ansible_compat.__version__)"
24.9.1
  • ansible installation method: one of source, pip, OS package
    pip
  • ansible-compat installation method: one of source, pip, OS package
    pip
STEPS TO REPRODUCE

Run ansible-lint on a project which has a requirement for a collection and uses a module from the collection in a playbook. The required collection must not be installed on the node before running ansible-lint

For example, add cloud.terraform to requiremenmts.yml, and cloud.terraform.terraform module to a plybook in the project.

Playbook:

    - name: Bring the infrastructure to state '{{ state }}'
      cloud.terraform.terraform:
        project_path: terraform/
        state: "{{ state }}"

requirements.yml:

---
collections:
  - name: cloud.terraform
    version: 2.0.0

Run ansible-lint in the project directory.

Desired Behavior

Module cloud.terraform.terraform should be successfully loaded on the fist run

Actual Behavior

'Unable to load module' warnings appear

# ansible-lint -v
INFO     Identified ***. as project root due .git directory.
INFO     Running ansible-galaxy collection install -v -r requirements.yml
INFO     Set ANSIBLE_LIBRARY=****/.cache/ansible-compat/2eca90/modules:/***/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=***/.cache/ansible-compat/2eca90/collections:***/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=***/.cache/ansible-compat/2eca90/roles:***/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Loading ignores from .gitignore
WARNING  Skipped installing collection dependencies due to running in offline mode.
INFO     Set ANSIBLE_LIBRARY=****/.cache/ansible-compat/2eca90/modules:***/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=***/.cache/ansible-compat/2eca90/collections:***/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=***/.cache/ansible-compat/2eca90/roles:***/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Executing syntax check on playbook main.yml (2.55s)
WARNING  Unable to load module cloud.terraform.terraform at main.yml:34 for options validation
WARNING  Unable to resolve FQCN for module cloud.terraform.terraform

@irozet12 irozet12 added bug Something isn't working new labels Oct 7, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 7, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 7, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 7, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 7, 2024
@ssbarnea ssbarnea removed the new label Oct 9, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
irozet12 pushed a commit to irozet12/ansible-compat that referenced this issue Oct 14, 2024
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: No status
Development

Successfully merging a pull request may close this issue.

2 participants