Project site: mutl3y.github.io/prism
From code to knowledge: automatically generate accurate, operator-friendly documentation for Ansible roles, collections, and repositories.
Ansible is the source of truth for your infrastructure, but its documentation is often the first source of technical debt. Manually written READMEs quickly become stale, making roles hard to reuse, difficult to onboard new team members, and risky to operate during incidents.
Prism treats documentation as code. It performs static analysis on Ansible content to generate accurate, operator-friendly documentation that stays aligned with source.
Prism goes beyond variable lists and captures operational context from the same source files your automation runs.
Problem: Most doc generators force a rigid template.
Prism's solution: Through prism-learn experimentation, GitHub Models were used to categorize section titles across more than 37,000 real-world roles. Prism recognizes common conventions, detects existing section headers (like Usage, Example Playbook, or Role Variables), and injects generated content while preserving hand-written prose.
Problem: When automation fails, operators need a procedure, not just code.
Prism's solution: Add marker comments like # prism~runbook: ..., # prism~warning: ..., and # prism~note: ... to tasks for human-centric guidance. Prism extracts these directives and produces a clear, ordered runbook.
Marker guidance: keep annotation payloads as plain text or compact key=value hints (for example owner=platform impact=high). Do not embed YAML structures in marker comments.
Valid compact examples:
# prism~runbook: owner=platform impact=high# prism~warning: rollback=manual timeout=300s
Example snippet:
# prism~runbook: Before proceeding, ensure no active transactions are in the message queue.
# prism~warning: Draining may take up to 5 minutes on large backlogs.
# prism~note: Use mq-status --check to verify queue health.
- name: Stop the primary application service
ansible.builtin.service:
name: my-app
state: stoppedProblem: You cannot manage what you cannot measure.
Prism's solution: Prism exports structured metadata across your automation fleet. The companion project, prism-learn, ingests that data to report on documentation quality, complexity hotspots, and dependency risk.
- Install Prism:
pip install prism-ansible - Move into your Ansible project:
cd /path/to/your/ansible-project - Run Prism against a role:
prism role roles/my-webserver-role - Review the generated role README.
- Scan a role:
prism role <path/to/role> - Scan a collection:
prism collection <path/to/collection> - Scan a repository role:
prism repo --repo-url <git-url> [--repo-role-path <path/in/repo>]
Run prism --help for the full command and option list.
Prism is designed to run in CI/CD so generated docs stay in sync with source.
Typical workflow:
- Install
prism-ansiblein the pipeline job. - Run
prism role ...orprism repo --repo-url ...during validation. - Commit or publish generated docs as part of your docs workflow.
Create a .prism.yml file in the target repo or role root to tune behavior.
Example:
readme:
adopt_heading_mode: style
include_sections:
- Capabilities
- Inputs / variables summary
- Requirements
section_content_modes:
Requirements: merge
Inputs / variables summary: generate
markers:
prefix: prism
scan:
fail_on_yaml_like_task_annotations: falseTo enforce strict annotation payload hygiene in CI, set scan.fail_on_yaml_like_task_annotations: true or pass --fail-on-yaml-like-task-annotations on the CLI.
Marker prefix rules:
- Default prefix:
prism - Allowed pattern:
[A-Za-z0-9_.-]+ - Allowed characters: letters, numbers,
_,.,-
Most deep technical material now lives in docs/:
docs/CHANGELOG.mddocs/changelog.mddocs/prism-friendly-role-authoring.mddocs/dev_docs/static-analysis-scope.mddocs/dev_docs/roadmap.mddocs/dev_docs/style-guide-sources.mddocs/dev_docs/ci-starter-workflows.md
Contributions are welcome. See docs/dev_docs/contributing.md.
Prism is licensed under the Apache License 2.0.