Documentation lives in two places:
- Plugin docstrings —
DOCUMENTATION,EXAMPLES,RETURNin each module file - Docusaurus site — generated from docstrings + hand-written content in
docs/
Plugin Python files (DOCUMENTATION/EXAMPLES/RETURN docstrings)
→ tasks/docs.py (extract_docstring, parse_ansible_doc)
→ Jinja2 templates (docs/_templates/*.mdx.j2)
→ MDX files (docs/docs/references/plugins/*.mdx)
→ Docusaurus build → Static site
# Generate plugin reference docs from docstrings
invoke generate-doc
# Build the full Docusaurus site
invoke docusaurus| Template | Purpose |
|---|---|
docs/_templates/plugin.mdx.j2 |
Individual plugin reference page |
docs/_templates/readme.mdx.j2 |
Landing page with plugin index |
Never edit these directly — they are overwritten by generate-doc:
docs/docs/references/plugins/<name>_module.mdx
docs/docs/references/plugins/<name>_inventory.mdx
docs/docs/references/plugins/<name>_lookup.mdx
docs/docs/readme.mdx
Edit the source docstrings in plugins/modules/*.py or the Jinja2 templates instead.
YAML format embedded in a Python triple-quoted string:
DOCUMENTATION = """
---
module: <name>
author:
- Opsmill (@opsmill)
version_added: "<x.y.z>"
short_description: <one line>
description:
- <paragraph>
requirements:
- infrahub-sdk
options:
<param_name>:
required: <True|False>
description:
- <text>
type: <str|int|bool|dict|list|raw>
default: <value>
"""YAML playbook examples:
EXAMPLES = """
---
- name: Example playbook title
gather_facts: false
hosts: localhost
tasks:
- name: Task description
opsmill.infrahub.<module>:
param: value
"""YAML describing return values:
RETURN = """
object:
description: The returned object
returned: success
type: dict
msg:
description: Status message
returned: always
type: str
"""docs/
docs/ # Content pages
references/
plugins/ # Generated plugin docs (*.mdx)
readme.mdx # Generated landing page
src/ # Docusaurus React source
static/ # Static assets
_templates/ # Jinja2 templates for generation
docusaurus.config.ts # Site configuration
sidebars.ts # Navigation sidebar
package.json # Node.js dependencies
cd docs
npm install
npm run build # or: invoke docusaurusConfiguration in .vale.ini at the repo root. Vale checks documentation for style consistency.
# Run Vale on docs
vale docs/CI runs Vale automatically on documentation changes (.github/workflows/workflow-linter.yml).
Configuration in .markdownlint.yml. Ensures consistent markdown formatting.
When adding a new module:
- Write complete
DOCUMENTATION,EXAMPLES, andRETURNdocstrings in the module file - Run
invoke generate-docto regenerate reference docs - Verify the generated MDX renders correctly with
invoke docusaurus
When adding features to existing modules:
- Update the relevant docstring sections
- Add new examples if the feature introduces new usage patterns
- Update
RETURNif new return values are added - Regenerate docs