Fix ansible-lint job

The ansible-linter was only running on playbooks, not on roles. This
patch corrects the tox environment to ensure that roles are linted.

Since roles weren't being linted, some errors had sneaked through. This
patch also corrects an unnamed task and disables linting of a task that
deliberately uses the shell module.

Also fix a comment in the tox file that was referencing a non-existent
zuul job.

Change-Id: I5b1ca3947e80588ab0cc8d3632f1292fc707aac1
This commit is contained in:
Colleen Murphy 2018-03-28 23:22:10 +02:00
parent 4022628db3
commit 665704e3dc
2 changed files with 7 additions and 2 deletions

View File

@ -2,7 +2,8 @@
# Configure attached ephemeral devices for storage and swap
- assert:
- name: Assert that ephemeral_device is defined
assert:
that:
- "ephemeral_device is defined"
@ -106,6 +107,8 @@
mount {{ opt_partition }} /mnt
find /opt/ -mindepth 1 -maxdepth 1 -exec mv {} /mnt/ \;
umount /mnt
tags:
- skip_ansible_lint
# This overmounts any existing /opt
- name: Add opt to fstab and mount

View File

@ -26,7 +26,7 @@ whitelist_externals = bash
passenv =
# NOTE(pabelanger): if you'd like to run tox -elinters locally, you'll need
# to export ANSIBLE_ROLES_PATH pointing to the currect repos.
# see infra-zuul-jobs-linters job for more information.
# see openstack-zuul-jobs-linters job for more information.
ANSIBLE_ROLES_PATH
commands =
flake8 {posargs}
@ -35,6 +35,8 @@ commands =
bash -c "find playbooks -type d -name "legacy" -prune -o \
-type f -regex '.*.y[a]ml' -print0 | xargs -t -n1 -0 \
ansible-lint -xANSIBLE0012"
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
xargs -t -n1 ansible-lint -xANSIBLE0012'
# Ansible Syntax Check
bash -c "cd playbooks; find . -type f -regex '.*.y[a]?ml' -exec \
ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \{\} + > /dev/null"