You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently ansible-lint cannot safely used like other linters which are able to look recursively inside the repository and lint whatever they find. Attempt to run ansible-lint . would result into a false-positive result, likely linting nothing if not playbook is present.
roles can be stored in multiple subdirectories: ci-scripts/container-push/roles,... and several others.
playbooks can also be scattered around in multiple locations
using exclude_paths can help but does not fix the inclusion part
finding all .yaml files and passing them to ansible-lint (like pre-commit does by default) would confuse it because it may not be able to identify the nature of these files and may end-up trying to parse tasks or vars as playbooks.
playbooks could be found inside roledir/molecule/*.yml with one notable exception: molecule.yml which is clearly not a playbook. I am not sure if we could just assume that the other files are playbooks or not.
While I do not mind making the assumption that roles are to found in folders with roles in their name, there is one signifiant exception: single-role repositories.
Before doing any work on this, we may need some help from Ansible team regarding on what information can and should be used to determine what is an Ansible playbook or role.
Desired outcome
If sorted correctly, newly added playbooks and roles should be linted without having to reconfigure the ansible-linter.
The user should be able to run ansible-lint without any arguments to lint the entire repository, just like flake8 and others are working.
The text was updated successfully, but these errors were encountered:
When called without any arguments, ansible-lint will now try to look
for all playbooks and roles inside current git repository.
Unrecognized YAML files will be displayed in verbose mode but will not
be considered errors. This will allow users to enable ansible-lint
on any repository without being forced to alter the way is called or
its configuration each time a new playbooks/role is added.
Fixes: #613Fixes: #564
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
Issue Type
Desired Behaviour
Currently ansible-lint cannot safely used like other linters which are able to look recursively inside the repository and lint whatever they find. Attempt to run
ansible-lint .
would result into a false-positive result, likely linting nothing if not playbook is present.Once complex repository example can be seen at https://github.com/rdo-infra/ci-config/ as this exposes several important aspects:
ci-scripts/container-push/roles
,... and several others.roledir/molecule/*.yml
with one notable exception:molecule.yml
which is clearly not a playbook. I am not sure if we could just assume that the other files are playbooks or not.While I do not mind making the assumption that
roles
are to found in folders withroles
in their name, there is one signifiant exception: single-role repositories.Before doing any work on this, we may need some help from Ansible team regarding on what information can and should be used to determine what is an Ansible playbook or role.
Desired outcome
If sorted correctly, newly added playbooks and roles should be linted without having to reconfigure the ansible-linter.
The user should be able to run
ansible-lint
without any arguments to lint the entire repository, just likeflake8
and others are working.The text was updated successfully, but these errors were encountered: