CI: add ansible-lint to linters job

Adapted from kolla-ansible setup.

Change-Id: I89fb9ccf03e445d1830dd5d525021cc5679d54a1
This commit is contained in:
Mark Goddard 2021-12-09 11:15:27 +00:00
parent 54d545a614
commit 5ac4536244
3 changed files with 22 additions and 0 deletions

15
.ansible-lint Normal file
View File

@ -0,0 +1,15 @@
---
use_default_rules: true
skip_list:
# [E503] Tasks that run when changed should likely be handlers
# TODO(mnasiadka): Rework roles to do handlers instead of when: *.changed
- no-handler
# [E208] permissions not mentioned
# FIXME(mnasiadka): Rework file/template to include permissions
- risky-file-permissions
# [unnamed-task] All tasks should be named
# FIXME(mgoddard): Add names to all tasks
- unnamed-task
# [ignore-errors] Use failed_when and specify error conditions instead of using ignore_errors
# FIXME(mgoddard): Use failed_when instead of ignore_errors
- ignore-errors

View File

@ -1,4 +1,5 @@
# linting
ansible-lint>=4.2.0,!=4.3.0 # MIT
bandit>=1.1.0 # Apache-2.0
bashate>=0.5.1 # Apache-2.0
doc8>=0.6.0 # Apache-2.0

View File

@ -89,6 +89,7 @@ commands =
{[testenv:bandit]commands}
{[testenv:yamllint]commands}
{[testenv:ansible-sanity]commands}
{[testenv:ansible-lint]commands}
[testenv:pep8]
deps = {[testenv:linters]deps}
@ -123,3 +124,8 @@ commands = yamllint -s .
[testenv:ansible-sanity]
deps = {[testenv:linters]deps}
commands = {toxinidir}/tools/run-ansible-sanity.sh {toxinidir}
[testenv:ansible-lint]
deps = {[testenv:linters]deps}
commands =
ansible-lint -p