diff --git a/.travis.yml b/.travis.yml index d603cabcb..33eceb2b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,8 @@ env: - TOX_ENV=docs # Run python2.7 unit tests. - TOX_ENV=py27 + # Run ansible syntax checks. + - TOX_ENV=ansible-syntax install: # Install a virtualenv for tox. diff --git a/tox.ini b/tox.ini index 14b4e7c97..68270674a 100644 --- a/tox.ini +++ b/tox.ini @@ -37,6 +37,26 @@ commands = oslo_debug_helper {posargs} [testenv:alint] 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] # E123, E125 skipped as they are invalid PEP-8.