Replies: 14 comments 7 replies
-
I'm also see this warnings, but other than @Vanav report, I actually activated the venv. $ ansible-lint
WARNING: ansible-lint is no longer tested under Python 3.8 and will soon require 3.9. Do not report bugs for this version.
WARNING Unable to load module ansible.windows.win_copy at playbooks/ssl_cert_windows.yaml:25 for options validation
WARNING Unable to load module ansible.windows.win_certificate_store at playbooks/ssl_cert_windows.yaml:31 for options validation
WARNING Unable to load module ansible.windows.win_file at playbooks/ssl_cert_windows.yaml:37 for options validation
WARNING Unable to load module community.windows.win_disk_facts at playbooks/facts.yaml:23 for options validation $ ansible-galaxy collection list
# /home/ansible/collections/ansible_collections
Collection Version
--------------------- -------
ansible.posix 1.4.0
ansible.windows 1.12.0
community.general 6.0.1
community.hashi_vault 4.0.0
community.vmware 2.10.2
community.windows 1.11.1 |
Beta Was this translation helpful? Give feedback.
-
Possibly related but I'm seeing the same symptoms as described here for all Windows modules: #2831 |
Beta Was this translation helpful? Give feedback.
-
I don't see this issue when I run ansible-lint locally (v6.10.0), but I do see it in my Actions workflow. I've reported it here: ansible/ansible-lint-action#99 (comment). |
Beta Was this translation helpful? Give feedback.
-
This is affecting me as well. requirements.yaml
In my action, I pre-install this.
I see the output of the
|
Beta Was this translation helpful? Give feedback.
-
I will be converting this to a discussion as there is no specific bug identified. I will fine a bug once we identify a clear bug. When it comes to use of GHA action, there are several things people need to remember because that is running inside a containers, so doing any preparatory work is unlikely to help in a any way. |
Beta Was this translation helpful? Give feedback.
-
I'm seeing this consistently github-actions or local. I find Pythons environment setup is at the best of time confusing; It looks like when we're lining the roles that refer to the modules in the collection - it's the FQCN that can't be resolved. |
Beta Was this translation helpful? Give feedback.
-
This starts happening for me when upgrading to v6.12.0 from v6.11.0 and running ansible-lint from pre-commit. Interestingly it doesn't happen when I run ansible-lint >v6.12.0 manually. |
Beta Was this translation helpful? Give feedback.
-
Managed to write minimal Dockerfile with PoC of this issue. There are no virtual environments in it, but loading modules doesn't work and produces warnings
|
Beta Was this translation helpful? Give feedback.
-
I am following up on this discussion from #2969. The error reported in the above issue seems to have started once I removed my globally installed ansible/ansible-lint and switched to a poetry-based installation of ansible/ansible-lint. While moving to poetry I have also installed ansible-core only (i.e. no ansible package with collections) because these are exclusively managed and installed from requirements.yaml in our case. |
Beta Was this translation helpful? Give feedback.
-
I originally created #2831 (comment), which was closed as FWIW, we are using |
Beta Was this translation helpful? Give feedback.
-
No idea how this is "not a bug" or was moved to a discussion. Everything used to work in my system prior to update from 6.11.x to 6.12.2 and now everything outside of Edited to add: I have in the past have problems with the offline mode, and the numerous releases trying to get it fixed. I am still continuing to use it and I wonder if this problem is because of offline mode. |
Beta Was this translation helpful? Give feedback.
-
At least some of the behavior in #2828 and #2831 can be explained by most of the modules in ansible.windows and community.windows being implemented in powershell rather than python. See https://github.com/ansible-collections/ansible.windows/blob/main/plugins/modules/win_ping.ps1 as an example. Attempting to load a python spec from a powershell source (https://github.com/ansible/ansible-lint/blob/v6.14.0/src/ansiblelint/rules/args.py#L111) fails and logs the "Unable to load..." warning with no further option validation (https://github.com/ansible/ansible-lint/blob/v6.14.0/src/ansiblelint/rules/args.py#L121). If it is a bug that these modules are not validated, then this test asserts the correct behavior: main...qwestduck:ansible-lint:test/2831-rules-args-windows-options-validation. I would think the way to get there might be parsing option constraints out of the python sidecar docfiles that accompany these powershell modules (for example https://github.com/ansible-collections/ansible.windows/blob/main/plugins/modules/win_ping.py), but that would add a lot to the rule for only a small set of modules. |
Beta Was this translation helpful? Give feedback.
-
So has anyone have a solution for this? Struggling to understand how this isn't a bug, or if it isn't what I am doing wrong. To make sure I am working with the correct collections, and just generally that paths are setup correctly in Ansible I set my ansible.cfg to only load collections from my ansible home: [defaults]
collections_scan_sys_path = False
collections_path = ~/.ansible/collections I verified this was working, and not loading anything, by attempting to list collections: $ ansible-galaxy collection list
usage: ansible-galaxy [-h] [--version] [-v] TYPE ...
Perform various Role and Collection related operations.
positional arguments:
TYPE
collection Manage an Ansible Galaxy collection.
role Manage an Ansible Galaxy role.
options:
--version show program's version number, config file location, configured module search path, module location, executable location and exit
-h, --help show this help message and exit
-v, --verbose verbose mode (-vvv for more, -vvvv to enable connection debugging)
ERROR! - None of the provided paths were usable. Please specify a valid path with --collections-path I then tried to run ansible lint. It failed being unable to load a large number of modules: $ ansible-lint
WARNING Listing 57 violation(s) that are fatal
syntax-check[specific]: couldn't resolve module/action 'community.docker.docker_prune'. This often indicates a misspelling, missing collection, or incorrect module path.
playbooks/docker-prune.yaml:6:7 I then installed all my collections and roles, and listed them out again: $ ansible-galaxy collection list
# /home/vscode/.ansible/collections/ansible_collections
Collection Version
--------------------- -------
ansible.posix 1.5.1
ansible.windows 1.13.0
chocolatey.chocolatey 1.4.0
community.docker 3.4.2
community.general 6.4.0
community.windows 1.12.0 I then ran ansible lint again and got the warnings others have been talking about, all of them Windows related: $ ansible-lint
WARNING Unable to load module community.windows.win_partition at roles/windows_base/tasks/disks.yaml:2 for options validation
WARNING Unable to load module ansible.windows.win_service at roles/windows_base/tasks/service.yaml:2 for options validation
WARNING Unable to load module ansible.windows.win_domain_membership at roles/windows_base/tasks/domain.yaml:2 for options validation What's interesting is that ansible.windows.win_template does not cause a warning, and it is used within our roles. That module does not have a .ps1 file in the collection, it only has a .py file. |
Beta Was this translation helpful? Give feedback.
-
I think I was able to narrow the issue down to the new args rule and opened a new bug report with a minimal example: |
Beta Was this translation helpful? Give feedback.
-
ansible-lint
displays warnings:I have installed ansible and ansible-lint in pipx environments, as recommended:
Playbook has no issues. I've tried to use FQCN for modules, but it doesn't change anything: same warnings, but with FQCN paths.
Beta Was this translation helpful? Give feedback.
All reactions