bifrost/tools/ansible-lint.sh
Dmitry Tantsur 6f825b0241 Add a CI job with ansible-lint
The implementation is copy-pasted with some tweaks from project-config
CI jobs. A list of exclusions is currently huge and should be reduced.

Change-Id: I7811884caa5d6c46e42bc4d1638ccaa4d17910b7
2020-08-24 13:15:34 +02:00

26 lines
777 B
Bash

#!/bin/bash
set -eu
DEST="$(dirname $0)/../playbooks/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="$DEST"
export ANSIBLE_LIBRARY="$(dirname $0)/../playbooks/library"
find playbooks -maxdepth 1 -type f -regex '.*.ya?ml' -print0 | \
xargs -t -n1 -0 ansible-lint -vv --nocolor
find playbooks/roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
xargs -t -n1 ansible-lint -vv --nocolor