Refreshes calling of ansible-lint

- Assure compatible version of Ansible is installed
- Make use of ability to detect roles and playbooks in linter, which
  also makes it execution ~9x faster.

Change-Id: Ife53d9f3161f6531102ed82f62f5d91c805e6cdc
This commit is contained in:
Sorin Sbarnea 2020-11-02 09:56:34 +00:00
parent 8279f640ba
commit 885e48c1b6
2 changed files with 4 additions and 7 deletions

View File

@ -4,6 +4,7 @@
hacking>=3.0,<3.1.0 # Apache-2.0
ansible>=2.7.0,<2.8
ansible-lint>=4,<=5
# ansible-lint requires ansible>=2.9
ansible>=2.9.0,<2.10
ansible-lint>=4.3.6,<=5
bashate>=0.2

View File

@ -32,11 +32,7 @@ setenv =
ANSIBLE_LIBRARY= {toxinidir}/tests/fake-ansible
commands =
flake8 {posargs}
bash -c "find playbooks -type d -name "legacy" -prune -o \
-type f -regex '.*.y[a]ml' -print0 | xargs -t -n1 -0 \
ansible-lint"
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
xargs -t -n1 ansible-lint'
ansible-lint
# Ansible Syntax Check
bash -c "cd playbooks; find . -type f -regex '.*.y[a]?ml' -exec \
ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \{\} + > /dev/null"