Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions scripts/install-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
# Dependencies: python3, pip, lib/log.sh, lib/platform.sh
#
# Tools installed:
# - ansible-lint (Ansible playbook/role linter — pulls ansible-core as dependency)
# - molecule (Ansible role testing framework)
# - ansible-lint (Ansible playbook/role linter — pulls ansible-core as dependency)
# - molecule (Ansible role testing framework)
# - community.general (Ansible collection — yaml callback, json_query, common modules)

set -euo pipefail

Expand Down Expand Up @@ -69,4 +70,14 @@ else
log_info "molecule installed successfully"
fi

# Install community.general collection (idempotent)
# Required for yaml callback plugin, json_query filter, and many common modules
if ansible-galaxy collection list community.general &>/dev/null; then
log_info "community.general collection is already installed, skipping"
else
log_info "Installing community.general Ansible collection"
ansible-galaxy collection install community.general
log_info "community.general collection installed successfully"
fi

log_info "Ansible tooling installation complete"
8 changes: 8 additions & 0 deletions tests/test-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ check_tool() {
check_tool "ansible-lint" "--version"
check_tool "molecule" "--version"

# Verify community.general collection is installed
if ansible-galaxy collection list community.general &>/dev/null; then
log_info "community.general collection — OK"
else
log_error "community.general Ansible collection is not installed"
FAILURES=$((FAILURES + 1))
fi

if [[ "${FAILURES}" -gt 0 ]]; then
log_error "Ansible tooling validation failed: ${FAILURES} tool(s) missing or broken"
exit 1
Expand Down
Loading