Merge "Fix ansible-lint.sh script for roles and playbooks"

This commit is contained in:
Jenkins 2017-03-17 15:29:05 +00:00 committed by Gerrit Code Review
commit d389caf9f8
2 changed files with 11 additions and 5 deletions

View File

@ -8,13 +8,20 @@ SKIPLIST="ANSIBLE0006,ANSIBLE0016"
# lint the playbooks separately to avoid linting the roles multiple times
pushd playbooks
find . -type f -regex '.*\.y[a]?ml' -print0 | xargs -0 ansible-lint -x $SKIPLIST || lint_error=1
for playbook in `find . -type f -regex '.*\.y[a]?ml'`; do
ansible-lint -vvv -x $SKIPLIST $playbook || lint_error=1
done
popd
# lint all the possible roles
find ./roles -type d -print0 | xargs -0 ansible-lint -x $SKIPLIST || lint_error=1
# Due to https://github.com/willthames/ansible-lint/issues/210, the roles
# directories need to contain a trailing slash at the end of the path.
for rolesdir in `find ./roles -maxdepth 1 -type d`; do
ansible-lint -vvv -x $SKIPLIST $rolesdir/ || lint_error=1
done
# exit with 1 if we had any error so far
# exit with 1 if we had a least an error or warning.
if [[ -n "$lint_error" ]]; then
exit 1;
fi

View File

@ -48,8 +48,7 @@
- when: inventory == 'multinode'
block:
- name: Get subnodes
shell: >-
cat /etc/nodepool/sub_nodes_private
command: cat /etc/nodepool/sub_nodes_private
register: nodes
- name: Add subnode to ansible inventory