bifrost/tools/ansible-lint.sh
Riccardo Pittau 01d242bcdd Fix deprecated module ansible lint error
Also reduce verbosity of ansible-lint as we don't really need
so much DEBUG output, errors may get lost in there.

Change-Id: I5f5a3ffd7f69275685695992732ed98549c6e5fa
2023-01-09 09:58:09 +01:00

26 lines
790 B
Bash

#!/bin/bash
set -eu
DEST="$(dirname $0)/../.tox/linters/collections"
SOURCE="${ANSIBLE_COLLECTION_SOURCE_PATH:-../ansible-collections-openstack}"
if [ ! -d "$SOURCE" ]; then
echo "Cannot find ansible-collections-openstack at $SOURCE"
exit 1
fi
rm -f "$DEST" || true
mkdir -p "$DEST/ansible_collections/openstack"
rm -f "$DEST/ansible_collections/openstack/cloud"
ln -s "$(realpath $SOURCE)" "$DEST/ansible_collections/openstack/cloud"
export ANSIBLE_COLLECTIONS_PATHS="$(realpath $DEST)"
export ANSIBLE_LIBRARY="$(dirname $0)/../playbooks/library"
find playbooks -maxdepth 1 -type f -regex '.*.ya?ml' -print0 | \
xargs -t -n1 -0 ansible-lint -v --nocolor
find playbooks/roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
xargs -t -n1 ansible-lint -v --nocolor