-
SummaryIf there's an invalid task file anywhere in the list of files that Issue Type
Ansible and Ansible Lint detailsansible --version
ansible [core 2.12.4]
config file = /Users/whegedus/.ansible.cfg
configured module search path = ['/Users/whegedus/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
ansible collection location = /Users/whegedus/bits/ansible_collections:/Users/whegedus/github:/Users/whegedus/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.10 (main, Jan 15 2022, 11:48:00) [Clang 13.0.0 (clang-1300.0.29.3)]
jinja version = 2.10.1
libyaml = False
ansible-lint --version
ansible-lint 6.0.2 using ansible 2.12.4
OS / ENVIRONMENTTested on MacOS Monterey and Debian 10 STEPS TO REPRODUCEPut invalid syntax in an imported/included file and observe with verbose logging that only playbooks are linted. See https://github.com/wbh1/ansible-lint-test for a working example. Desired Behavior
This is what happens when the invalid syntax block is commented out: ❯ ansible-lint -vvv
WARNING: PATH altered to include /usr/local/opt/[email protected]/bin
DEBUG Logging initialized to level 10
DEBUG Options: Namespace(cache_dir='/Users/whegedus/.cache/ansible-compat/f23de3', colored=True, configured=True, cwd=PosixPath('/Users/whegedus/github/wbh1/ansible-lint-test'), display_relative_path=True, exclude_paths=['.cache', '.git', '.hg', '.svn', '.tox'], format='rich', lintables=[], listrules=False, listtags=False, write=False, parseable=False, quiet=0, rulesdirs=['/usr/local/lib/python3.9/site-packages/ansiblelint/rules'], skip_list=[], tags=[], verbosity=3, warn_list=['experimental', 'role-name'], kinds=[{'jinja2': '**/*.j2'}, {'jinja2': '**/*.j2.*'}, {'text': '**/templates/**/*.*'}, {'inventory': '**/inventory/**.yml'}, {'requirements': '**/meta/requirements.yml'}, {'galaxy': '**/galaxy.yml'}, {'reno': '**/releasenotes/*/*.{yaml,yml}'}, {'playbook': '**/playbooks/*.{yml,yaml}'}, {'playbook': '**/*playbook*.{yml,yaml}'}, {'role': '**/roles/*/'}, {'tasks': '**/tasks/**/*.{yaml,yml}'}, {'handlers': '**/handlers/*.{yaml,yml}'}, {'vars': '**/{host_vars,group_vars,vars,defaults}/**/*.{yaml,yml}'}, {'meta': '**/meta/main.{yaml,yml}'}, {'yaml': '.config/molecule/config.{yaml,yml}'}, {'requirements': '**/molecule/*/{collections,requirements}.{yaml,yml}'}, {'yaml': '**/molecule/*/{base,molecule}.{yaml,yml}'}, {'requirements': '**/requirements.yml'}, {'playbook': '**/molecule/*/*.{yaml,yml}'}, {'yaml': '**/{.ansible-lint,.yamllint}'}, {'yaml': '**/*.{yaml,yml}'}, {'yaml': '**/.*.{yaml,yml}'}], mock_modules=[], mock_roles=[], loop_var_prefix=None, var_naming_pattern=None, offline=None, project_dir='.', extra_vars=None, enable_list=[], skip_action_validation=True, rules={}, progressive=False, rulesdir=[], use_default_rules=False, config_file=None, version=False)
DEBUG /Users/whegedus/github/wbh1/ansible-lint-test
INFO Set ANSIBLE_LIBRARY=/Users/whegedus/.cache/ansible-compat/f23de3/modules:/Users/whegedus/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO Set ANSIBLE_COLLECTIONS_PATH=/Users/whegedus/.cache/ansible-compat/f23de3/collections:/Users/whegedus/bits/ansible_collections:/Users/whegedus/github:/Users/whegedus/.ansible/collections:/usr/share/ansible/collections
INFO Set ANSIBLE_ROLES_PATH=/Users/whegedus/.cache/ansible-compat/f23de3/roles:roles:/Users/whegedus/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
DEBUG Loading rules from /usr/local/lib/python3.9/site-packages/ansiblelint/rules
DEBUG Effective yamllint rules used: {'braces': {'level': 'error', 'forbid': False, 'min-spaces-inside': 0, 'max-spaces-inside': 0, 'min-spaces-inside-empty': -1, 'max-spaces-inside-empty': -1}, 'brackets': {'level': 'error', 'forbid': False, 'min-spaces-inside': 0, 'max-spaces-inside': 0, 'min-spaces-inside-empty': -1, 'max-spaces-inside-empty': -1}, 'colons': {'level': 'error', 'max-spaces-before': 0, 'max-spaces-after': 1}, 'commas': {'level': 'error', 'max-spaces-before': 0, 'min-spaces-after': 1, 'max-spaces-after': 1}, 'comments': {'level': 'warning', 'require-starting-space': True, 'ignore-shebangs': True, 'min-spaces-from-content': 1}, 'comments-indentation': False, 'document-end': False, 'document-start': False, 'empty-lines': {'level': 'error', 'max': 2, 'max-start': 0, 'max-end': 0}, 'empty-values': False, 'hyphens': {'level': 'error', 'max-spaces-after': 1}, 'indentation': {'level': 'error', 'spaces': 'consistent', 'indent-sequences': True, 'check-multi-line-strings': False}, 'key-duplicates': {'level': 'error'}, 'key-ordering': False, 'line-length': {'level': 'error', 'max': 160, 'allow-non-breakable-words': True, 'allow-non-breakable-inline-mappings': False}, 'new-line-at-end-of-file': {'level': 'error'}, 'new-lines': {'level': 'error', 'type': 'unix'}, 'octal-values': False, 'quoted-strings': False, 'trailing-spaces': {'level': 'error'}, 'truthy': {'level': 'warning', 'allowed-values': ['true', 'false'], 'check-keys': True}}
INFO Looking up for files, excluding .cache|.git|.hg|.svn|.tox ...
DEBUG Added role: roles/cleanup (role)
INFO Looking up for files, excluding .cache|.git|.hg|.svn|.tox ...
INFO Executing syntax check on playbooks/test.yml (2.10s)
DEBUG Examining playbooks/test.yml of type playbook
DEBUG Examining roles/cleanup/tasks/uninstall.yml of type tasks
DEBUG Examining roles/cleanup of type role
DEBUG Examining roles/cleanup/tasks/main.yml of type tasks
WARNING Listing 1 violation(s) that are fatal
fqcn-builtins: Use FQCN for builtin actions.
roles/cleanup/tasks/uninstall.yml:2 Task/Handler: uninstall something
You can skip specific rules or tags by adding them to your configuration file:
# .config/ansible-lint.yml
warn_list: # or 'skip_list' to silence them completely
- fqcn-builtins # Use FQCN for builtin actions.
Finished with 1 failure(s), 0 warning(s) on 4 files. Actual Behavior❯ ansible-lint -vvv
WARNING: PATH altered to include /usr/local/opt/[email protected]/bin
DEBUG Logging initialized to level 10
DEBUG Options: Namespace(cache_dir='/Users/whegedus/.cache/ansible-compat/f23de3', colored=True, configured=True, cwd=PosixPath('/Users/whegedus/github/wbh1/ansible-lint-test'), display_relative_path=True, exclude_paths=['.cache', '.git', '.hg', '.svn', '.tox'], format='rich', lintables=[], listrules=False, listtags=False, write=False, parseable=False, quiet=0, rulesdirs=['/usr/local/lib/python3.9/site-packages/ansiblelint/rules'], skip_list=[], tags=[], verbosity=3, warn_list=['experimental', 'role-name'], kinds=[{'jinja2': '**/*.j2'}, {'jinja2': '**/*.j2.*'}, {'text': '**/templates/**/*.*'}, {'inventory': '**/inventory/**.yml'}, {'requirements': '**/meta/requirements.yml'}, {'galaxy': '**/galaxy.yml'}, {'reno': '**/releasenotes/*/*.{yaml,yml}'}, {'playbook': '**/playbooks/*.{yml,yaml}'}, {'playbook': '**/*playbook*.{yml,yaml}'}, {'role': '**/roles/*/'}, {'tasks': '**/tasks/**/*.{yaml,yml}'}, {'handlers': '**/handlers/*.{yaml,yml}'}, {'vars': '**/{host_vars,group_vars,vars,defaults}/**/*.{yaml,yml}'}, {'meta': '**/meta/main.{yaml,yml}'}, {'yaml': '.config/molecule/config.{yaml,yml}'}, {'requirements': '**/molecule/*/{collections,requirements}.{yaml,yml}'}, {'yaml': '**/molecule/*/{base,molecule}.{yaml,yml}'}, {'requirements': '**/requirements.yml'}, {'playbook': '**/molecule/*/*.{yaml,yml}'}, {'yaml': '**/{.ansible-lint,.yamllint}'}, {'yaml': '**/*.{yaml,yml}'}, {'yaml': '**/.*.{yaml,yml}'}], mock_modules=[], mock_roles=[], loop_var_prefix=None, var_naming_pattern=None, offline=None, project_dir='.', extra_vars=None, enable_list=[], skip_action_validation=True, rules={}, progressive=False, rulesdir=[], use_default_rules=False, config_file=None, version=False)
DEBUG /Users/whegedus/github/wbh1/ansible-lint-test
INFO Set ANSIBLE_LIBRARY=/Users/whegedus/.cache/ansible-compat/f23de3/modules:/Users/whegedus/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO Set ANSIBLE_COLLECTIONS_PATH=/Users/whegedus/.cache/ansible-compat/f23de3/collections:/Users/whegedus/bits/ansible_collections:/Users/whegedus/github:/Users/whegedus/.ansible/collections:/usr/share/ansible/collections
INFO Set ANSIBLE_ROLES_PATH=/Users/whegedus/.cache/ansible-compat/f23de3/roles:roles:/Users/whegedus/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
DEBUG Loading rules from /usr/local/lib/python3.9/site-packages/ansiblelint/rules
DEBUG Effective yamllint rules used: {'braces': {'level': 'error', 'forbid': False, 'min-spaces-inside': 0, 'max-spaces-inside': 0, 'min-spaces-inside-empty': -1, 'max-spaces-inside-empty': -1}, 'brackets': {'level': 'error', 'forbid': False, 'min-spaces-inside': 0, 'max-spaces-inside': 0, 'min-spaces-inside-empty': -1, 'max-spaces-inside-empty': -1}, 'colons': {'level': 'error', 'max-spaces-before': 0, 'max-spaces-after': 1}, 'commas': {'level': 'error', 'max-spaces-before': 0, 'min-spaces-after': 1, 'max-spaces-after': 1}, 'comments': {'level': 'warning', 'require-starting-space': True, 'ignore-shebangs': True, 'min-spaces-from-content': 1}, 'comments-indentation': False, 'document-end': False, 'document-start': False, 'empty-lines': {'level': 'error', 'max': 2, 'max-start': 0, 'max-end': 0}, 'empty-values': False, 'hyphens': {'level': 'error', 'max-spaces-after': 1}, 'indentation': {'level': 'error', 'spaces': 'consistent', 'indent-sequences': True, 'check-multi-line-strings': False}, 'key-duplicates': {'level': 'error'}, 'key-ordering': False, 'line-length': {'level': 'error', 'max': 160, 'allow-non-breakable-words': True, 'allow-non-breakable-inline-mappings': False}, 'new-line-at-end-of-file': {'level': 'error'}, 'new-lines': {'level': 'error', 'type': 'unix'}, 'octal-values': False, 'quoted-strings': False, 'trailing-spaces': {'level': 'error'}, 'truthy': {'level': 'warning', 'allowed-values': ['true', 'false'], 'check-keys': True}}
INFO Looking up for files, excluding .cache|.git|.hg|.svn|.tox ...
DEBUG Added role: roles/cleanup (role)
INFO Looking up for files, excluding .cache|.git|.hg|.svn|.tox ...
INFO Executing syntax check on playbooks/test.yml (2.27s) minimum complete verifiable example: https://github.com/wbh1/ansible-lint-test |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
This behavior was introduced in #1984 in which the error no longer is wrapped and does not get propagated to the user. Confirmed that changing to |
Beta Was this translation helpful? Give feedback.
-
This problem still occurs on v6.3.0. The linked demo-repository still fails silently. |
Beta Was this translation helpful? Give feedback.
-
@rndmh3ro I am not able to reproduce. Could you share more information as to how you are seeing this? This is the output I just got with a fresh install of v6.3.0 of ansible-lint using that demo repository. <... omitted ...>
The offending line appears to be:
handlers:
^ here
❯ ansible-lint --version
WARNING: PATH altered to include /usr/local/opt/[email protected]/bin
ansible-lint 6.3.0 using ansible 2.12.6 |
Beta Was this translation helpful? Give feedback.
-
Please don't use ansible-issue tracker for support questions. Your |
Beta Was this translation helpful? Give feedback.
Please don't use ansible-issue tracker for support questions. Your
uninstall.yml
file is not even a valid YAML file, check again.