Add ansible-lint support for playbooks
Change-Id: Id9515f482c52d25328fbc1be48cc6f5865e74a46 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
822a950d43
commit
081decef02
14
tox.ini
14
tox.ini
@ -4,6 +4,7 @@ envlist = linters
|
|||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
basepython = python3
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
@ -19,5 +20,16 @@ builtins = _
|
|||||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||||
|
|
||||||
[testenv:linters]
|
[testenv:linters]
|
||||||
|
setenv =
|
||||||
|
ANSIBLE_ROLES_PATH = ..
|
||||||
|
whitelist_externals = bash
|
||||||
commands =
|
commands =
|
||||||
yamllint -s .
|
# PEP8 Lint Check
|
||||||
|
flake8
|
||||||
|
# Ansible Lint Check
|
||||||
|
bash -c "find . -not -path '*/\.*' -type f -regex '.*.y[a]?ml' -print0 | \
|
||||||
|
xargs -t -n1 -0 ansible-lint -x 306"
|
||||||
|
# Ansible Syntax Check
|
||||||
|
bash -c "find tests -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \
|
||||||
|
ansible-playbook --syntax-check -i tests/inventory \
|
||||||
|
-e rolename=$(basename $(pwd)) > /dev/null"
|
||||||
|
Loading…
Reference in New Issue
Block a user