-
Notifications
You must be signed in to change notification settings - Fork 654
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
Version 5.0.0 lints variable files as if they were playbooks #1357
Comments
You failed to mention the most important bits: command line used to executed the linter and the file content. The full path of the file is essential in deciding the file type. My guess is that your file path is not really fitting into the patterns from: https://github.com/ansible-community/ansible-lint/blob/master/src/ansiblelint/config.py#L15-L29 |
Consider the file vault_version: 1.6.1 $ ansible-lint vars/common/vault-common.yml
Added ANSIBLE_ROLES_PATH=roles
WARNING Overriding detected file kind 'yaml' with 'playbook' for given positional argument: vars/common/vault-common.yml
WARNING Listing 1 violation(s) that are fatal
syntax-check: A playbook must be a list of plays, got a <class 'ansible.parsing.yaml.objects.AnsibleMapping'> instead
vars/common/vault-common.yml:1:1 [WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
ERROR! A playbook must be a list of plays, got a <class 'ansible.parsing.yaml.objects.AnsibleMapping'> instead
The error appears to be in '/Users/kdubonalume/projects/jini_ansible_playbooks/vars/common/vault-common.yml': line 1, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
vault_version: 1.6.1
^ here
You can skip specific rules or tags by adding them to your configuration file:
# .ansible-lint
warn_list: # or 'skip_list' to silence them completely
- syntax-check # Ansible syntax check failed
Finished with 1 failure(s), 0 warning(s) on 1 files. |
I'm guessing |
That may be true and fixable, we need to update both the pattern and the test file to be sure that your case is recognised, especially as I find it as making sense. |
No worries, I'll stay on 4.2.0 for now.
|
This issue appears to affect files under host_vars and group_vars, too.
(Unlike #115, decryption appears working like previous versions) |
Summary
Issue Type
Ansible and Ansible Lint details
OS / ENVIRONMENT
Reproducible on macOS 11.2.1 and
python:3-slim
docker imageSTEPS TO REPRODUCE
Try linting a variable file, such as your role/defaults/main.yaml or any file you use in a
vars_files
argument.Desired Behaviour
Like in version 4.2.0 (last one installed before the upgrade), ansible-lint should return no issues and return_code 0.
Actual Behaviour
In version 5.0.0, ansible-lint will return
The text was updated successfully, but these errors were encountered: