updated directory and f iles for molecule troubleshooting
This commit is contained in:
parent
8f3291499f
commit
1610554eea
|
|
@ -0,0 +1,63 @@
|
|||
name: OpenCMMC Stack CI Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
terraform-validate:
|
||||
name: Terraform Validate
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: terraform/
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v3
|
||||
with:
|
||||
terraform_version: 1.6.6 # <- Pin version you're using
|
||||
|
||||
- name: Initialize Terraform
|
||||
run: terraform init -backend=false
|
||||
|
||||
- name: Validate Terraform
|
||||
run: terraform validate
|
||||
|
||||
ansible-molecule:
|
||||
name: Ansible Molecule Test
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
role:
|
||||
- secure_ubuntu
|
||||
- podman_services
|
||||
- identity
|
||||
- monitoring
|
||||
- file_storage
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ansible/roles/${{ matrix.role }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install Ansible + Molecule + Drivers
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install ansible ansible-lint molecule molecule-plugins[docker] docker
|
||||
|
||||
- name: Run Molecule Tests
|
||||
run: |
|
||||
molecule test
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "🔍 Checking Molecule structure under ansible/roles/..."
|
||||
|
||||
# Define your role list
|
||||
roles=( secure_ubuntu podman_services identity file_storage monitoring preflight )
|
||||
|
||||
exit_code=0
|
||||
|
||||
for role in "${roles[@]}"
|
||||
do
|
||||
echo "-------------------------------------------------"
|
||||
echo "🔎 Checking role: $role"
|
||||
|
||||
role_path="ansible/roles/$role/molecule/default"
|
||||
|
||||
# Check if molecule/default/ exists
|
||||
if [ ! -d "$role_path" ]; then
|
||||
echo "❌ ERROR: Missing $role_path directory"
|
||||
exit_code=1
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check if molecule.yml exists
|
||||
if [ ! -f "$role_path/molecule.yml" ]; then
|
||||
echo "❌ ERROR: Missing molecule.yml in $role_path"
|
||||
exit_code=1
|
||||
else
|
||||
echo "✅ molecule.yml found."
|
||||
fi
|
||||
|
||||
# Check if scenario.yml exists
|
||||
if [ ! -f "$role_path/scenario.yml" ]; then
|
||||
echo "❌ ERROR: Missing scenario.yml in $role_path"
|
||||
exit_code=1
|
||||
else
|
||||
echo "✅ scenario.yml found."
|
||||
fi
|
||||
|
||||
# Optional: check create/converge/destroy/verify
|
||||
for file in create.yml converge.yml destroy.yml verify.yml
|
||||
do
|
||||
if [ ! -f "$role_path/$file" ]; then
|
||||
echo "⚠️ WARNING: Missing $file in $role_path (not critical but needed)"
|
||||
else
|
||||
echo "✅ $file present."
|
||||
fi
|
||||
done
|
||||
|
||||
# Check if molecule.yml has valid YAML header
|
||||
if ! grep -qE '^---' "$role_path/molecule.yml"; then
|
||||
echo "❌ ERROR: molecule.yml does not start with valid YAML (---)"
|
||||
exit_code=1
|
||||
else
|
||||
echo "✅ molecule.yml starts with valid YAML header."
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
echo "-------------------------------------------------"
|
||||
|
||||
if [ "$exit_code" -eq 0 ]; then
|
||||
echo "🎉 All Molecule role structures look good!"
|
||||
else
|
||||
echo "⚠️ There are some problems. Please fix them."
|
||||
fi
|
||||
|
||||
exit $exit_code
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: docker
|
||||
platforms:
|
||||
- name: instance
|
||||
provisioner:
|
||||
name: ansible
|
||||
scenario:
|
||||
name: default
|
||||
Loading…
Reference in New Issue