Files
computer-playbook/utils/templating
kevinveenbirkenbachandClaude Opus 5 1982e19746 fix(docs): let docutils read the examples in these docstrings
Two shapes of the same reStructuredText mistake, 23 of the build's
docutils messages between them.

An indented example after a paragraph ending in ':' needs '::', or the
block becomes a block quote and every deeper line reports unexpected
indentation. That covers the yaml example in mounts, the call examples in
rbac_group_path and container_extra_hosts, and the formulas in
memory_filters, which are also indented to sit under the marker.

A bullet list needs a blank line to the paragraph above it, or docutils
reads the first item as a continuation. That covers cache/yaml, jinja and
active_docker, the last one nesting a second list that needs the same.

Rendered text is unchanged: '::' renders as ':', and the blank lines are
structure rather than presentation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-25 18:55:40 +02:00
..

Templating Utilities 🧩

Strict Jinja renderers used by lookup plugins, library modules, and the YAML cache layer.

Scope 📋

Modules in utils/templating/ MUST limit themselves to rendering {{ ... }} and {% ... %} constructs found in YAML values, lookups, and templated config strings.

Both renderers fail loudly when Jinja markers cannot be resolved so generated configs never silently leak unrendered placeholders.

Modules 📦

Module Engine When to use
ansible.py Ansible's internal Templar (with TrustedAsTemplate tagging for Ansible 2.19+) When the caller already has Ansible's variable stack and wants tag-aware rendering with shortcuts for lookup('env', ...), simple var.path lookups, and literal coercion.
jinja.py Standalone jinja2.Environment When the caller runs in a context where Templar can silently leave markers untouched (some lookup plugin entry points). Renders multiple passes so nested vars (A.x = "{{ B.y }}", B.y = "{{ C.z }}") collapse fully.

Example Imports ✍️

from utils.templating.ansible import render_ansible_strict
from utils.templating.jinja import render_strict