blob: 063ddeeac9c2e5b2b828bb6b6ae89e8feef39a95 [file] [log] [blame]
Zack Williams1aaa3b12016-09-01 09:55:17 -07001#!/usr/bin/env bash
2set +e
3fail_ansible=0
4
5# verify that we have ansible-lint installed
6command -v ansible-lint >/dev/null 2>&1 || { echo "ansible-lint not found, please install it" >&2; exit 1; }
7
8# when not running under Jenkins, use current dir as workspace
9WORKSPACE=${WORKSPACE:-.}
10
11echo "=> Linting Ansible Code with" `ansible-lint --version`
12for f in `find $WORKSPACE -name "*.yml"`; do
13 echo "==> CHECKING: $f"
14 ansible-lint -p $f
15 rc=$?
16 if [[ $rc != 0 ]]; then
17 echo "==> LINTING FAIL: $f"
18 fail_ansible=1
19 fi
20done
21
22exit 0