Add a tox environment ansible-syntax for checking ansible syntax
Run this environment in TravisCI.
This commit is contained in:
parent
3970b875d4
commit
7281847095
@ -22,6 +22,8 @@ env:
|
|||||||
- TOX_ENV=docs
|
- TOX_ENV=docs
|
||||||
# Run python2.7 unit tests.
|
# Run python2.7 unit tests.
|
||||||
- TOX_ENV=py27
|
- TOX_ENV=py27
|
||||||
|
# Run ansible syntax checks.
|
||||||
|
- TOX_ENV=ansible-syntax
|
||||||
|
|
||||||
install:
|
install:
|
||||||
# Install a virtualenv for tox.
|
# Install a virtualenv for tox.
|
||||||
|
20
tox.ini
20
tox.ini
@ -37,6 +37,26 @@ commands = oslo_debug_helper {posargs}
|
|||||||
[testenv:alint]
|
[testenv:alint]
|
||||||
commands = ansible-lint ansible/*.yaml
|
commands = ansible-lint ansible/*.yaml
|
||||||
|
|
||||||
|
[testenv:ansible-syntax]
|
||||||
|
commands =
|
||||||
|
# Install ansible role dependencies from Galaxy.
|
||||||
|
ansible-galaxy install \
|
||||||
|
-r {toxinidir}/requirements.yml \
|
||||||
|
-p {toxinidir}/ansible/roles
|
||||||
|
# Perform an Ansible syntax check. Skip some playbooks which require extra
|
||||||
|
# variables to be defined.
|
||||||
|
bash -c \
|
||||||
|
"ansible-playbook \
|
||||||
|
--connection=local \
|
||||||
|
--syntax-check \
|
||||||
|
--list-tasks \
|
||||||
|
$(find {toxinidir}/ansible \
|
||||||
|
-maxdepth 1 \
|
||||||
|
-name '*.yml' \
|
||||||
|
-not -name idrac-bootstrap-one.yml \
|
||||||
|
-not -name idrac-bootstrap.yml) \
|
||||||
|
{posargs}"
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# E123, E125 skipped as they are invalid PEP-8.
|
# E123, E125 skipped as they are invalid PEP-8.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user