Add ansible-syntax to tox -eansible-lint
Here we are using ansible-playbook to validate the syntax of our role. Change-Id: I751392769774b44b9cf8d6f0cddf60b591c345cd Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
98ffeca217
commit
bbffbc01d9
2
tests/ansible.cfg
Normal file
2
tests/ansible.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
[defaults]
|
||||
roles_path = ..
|
1
tests/inventory
Normal file
1
tests/inventory
Normal file
@ -0,0 +1 @@
|
||||
localhost
|
17
tests/test001.yaml
Normal file
17
tests/test001.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright 2015 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
---
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- "{{ rolename }}"
|
17
tests/test002.yaml
Normal file
17
tests/test002.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright 2015 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
---
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- { role: "{{ rolename }}", nodepool_install_method: 'pip' }
|
5
tox.ini
5
tox.ini
@ -8,9 +8,14 @@ deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:ansible-lint]
|
||||
setenv =
|
||||
ANSIBLE_CONFIG = tests/ansible.cfg
|
||||
whitelist_externals = bash
|
||||
commands =
|
||||
bash -c "find . -type f -regex '.*.y[a]?ml' -execdir ansible-lint \{\} \;"
|
||||
bash -c "find tests -type f -regex '.*.y[a]?ml' | xargs -n1 \
|
||||
ansible-playbook --syntax-check -i tests/inventory \
|
||||
-e rolename=$(basename $(pwd))"
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
Loading…
x
Reference in New Issue
Block a user