Files
infrastructure/scripts/ci/check_ansible_syntax.sh
vibe-agent 962b387b42
ci-static / secret-scan (push) Successful in 42s
ci-static / yamllint (push) Successful in 1m6s
ci-static / ansible-syntax (push) Successful in 42s
ci-static / markdown-links (push) Successful in 20s
M5: statische CI (Gitea Actions) + CT-116 Runner + Branch-Protection main (#2)
Co-authored-by: vibe-agent <vibe-agent@ghostnet.local>
2026-11-11 06:07:36 +01:00

22 lines
757 B
Bash

#!/bin/bash
# Syntax-Check aller Ansible-Projekte im Repo (CI, GNAI-001 M5).
# ansible-core kommt gepinnt aus shared/ansible/requirements-control.txt.
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
fail=0
while IFS= read -r cfg; do
dir=$(dirname "$cfg")
echo "== Projekt $dir =="
while IFS= read -r pb; do
(cd "$dir" && ansible-playbook -i /dev/null "$pb" --syntax-check >/dev/null 2>&1) \
|| { (cd "$dir" && ansible-playbook -i /dev/null "$pb" --syntax-check) || true; fail=1; }
done < <(cd "$dir" && ls playbooks/*.yml 2>/dev/null || true)
done < <(git ls-files -z 'ansible.cfg' | tr '\0' '\n' | grep -v '^\.venv/')
if [ "$fail" -ne 0 ]; then
echo "ANSIBLE-SYNTAX: FEHLER (siehe oben)"
exit 1
fi
echo "ANSIBLE-SYNTAX: OK"