summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Copeland <ben.copeland@linaro.org>2016-09-27 01:16:36 +0100
committerBen Copeland <ben.copeland@linaro.org>2016-09-28 22:05:55 +0000
commit140eb235fe7b6b246550cecb1ed5b181724d364d (patch)
tree2c2d6df6e64f9b3bda95cffc5cd8f02bc4bc058a /tests
parentdfc79556266e3401bca8bfaf0197748f38e4ae90 (diff)
downloadansible-playbooks-140eb235fe7b6b246550cecb1ed5b181724d364d.tar.gz
Unit Test
Introduce Ansible Linting into our playbook. Change-Id: Ie073e2214d5feda73160190580867faf516aff60 Reviewed-on: https://review.linaro.org/14513 Reviewed-by: Ben Copeland <ben.copeland@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ansible-lint-test.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ansible-lint-test.sh b/tests/ansible-lint-test.sh
new file mode 100644
index 0000000..5c08008
--- /dev/null
+++ b/tests/ansible-lint-test.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -x
+
+echo "=> Linting Ansible Code"
+fail_ansible=0
+for f in `find ../ -name "*.yml"`; do
+ echo "==> LINTING $f"
+ ansible-lint -x ANSIBLE0004 $f # Ignore GIT check
+ rc=$?
+ if [[ $rc != 0 ]]; then
+ echo "==> LINTING FAIL: $f"
+ fail_ansible=1
+ fi
+done
+
+if [[ $fail_ansible == 1 ]]; then
+ echo "=> FAIL"
+ exit 1
+else
+ echo "=> SUCCESS"
+fi
+