Add ansible-lint in tests

This commit is contained in:
Miguel Jacq 2025-12-15 11:29:19 +11:00
parent 4cdc78915f
commit 3f0e38dadf
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
2 changed files with 20 additions and 4 deletions

View file

@ -1,8 +1,24 @@
#!/bin/bash
set -eo pipefail
# Pytests
poetry run pytest -vvvv --cov=enroll --cov-report=term-missing --disable-warnings
poetry run enroll enroll --harvest /tmp/bundle --out /tmp/ansible && \
cd /tmp/ansible && \
sudo ansible-playbook playbook.yml -i "localhost," -c local --check --diff
BUNDLE_DIR="/tmp/bundle"
ANSIBLE_DIR="/tmp/ansible"
rm -rf "${BUNDLE_DIR}" "${ANSIBLE_DIR}"
# Generate data
poetry run \
enroll enroll \
--harvest "${BUNDLE_DIR}" \
--out "${ANSIBLE_DIR}"
builtin cd "${ANSIBLE_DIR}"
# Lint
ansible-lint "${ANSIBLE_DIR}"
# Run
sudo ansible-playbook playbook.yml -i "localhost," -c local --check --diff