Files
FabledSteward/steward/templates/ansible/_playbook_vars.html
T
bvandeusen e5f6a11f94
CI / lint (push) Successful in 3s
CI / unit (push) Successful in 8s
CI / integration (push) Successful in 2m15s
CI / publish (push) Successful in 52s
feat(ansible): playbooks self-describe via "# description:" comment
Playbooks can ship a human description Steward reads and shows when one is
selected. Convention: a `# description: <text>` magic comment (Ansible rejects
unknown play keys, so a comment is the portable place — works for third-party
playbooks too); falls back to the first play's name:. sources
.discover_playbook_description().

Surfaced at the top of the shared _playbook_vars.html partial, which loads on
playbook selection in the host run form, schedules form, and browse run form.
All four bundled playbooks (provision/install/update/docker_prune) now carry a
description line. Unit tests added.

Scribe #900.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 11:25:25 -04:00

39 lines
1.7 KiB
HTML

{# Description + discovered variable fields for a selected playbook. Shared by
the browse run form, host run form, and schedule form. Expects `variables`
and `description`. Rendered standalone by /ansible/playbook-vars. #}
{% if description %}
<div style="background:var(--bg);border-left:3px solid var(--accent);border-radius:3px;
padding:0.5rem 0.7rem;margin:0.25rem 0 0.6rem;font-size:0.82rem;color:var(--text-muted);">
{{ description }}
</div>
{% endif %}
{% if variables %}
<div style="margin:0.5rem 0 0.25rem;font-size:0.82rem;color:var(--text-muted);font-weight:600;">
Playbook variables
</div>
<p style="color:var(--text-dim);font-size:0.76rem;margin:0 0 0.6rem;">
Leave a field blank to use the playbook/inventory default. Secret fields are never stored.
</p>
{% for v in variables %}
<div class="form-group">
<label>
{{ v.prompt or v.name }}
<span style="color:var(--text-muted);font-weight:normal;font-size:0.76rem;">
({{ v.name }}{% if v.required %}, required{% endif %}{% if v.secret %}, secret{% endif %})
</span>
</label>
{% if v.secret %}<input type="hidden" name="secret__{{ v.name }}" value="1">{% endif %}
<input type="{{ 'password' if v.secret else 'text' }}"
name="var__{{ v.name }}"
{% if v.required %}required{% endif %}
{% if v.secret %}autocomplete="new-password"{% endif %}
placeholder="{% if v.secret %}(hidden){% elif v.default not in (None, '') %}default: {{ v.default }}{% else %}no default{% endif %}"
style="width:100%;font-family:ui-monospace,monospace;font-size:0.85rem;">
</div>
{% endfor %}
{% else %}
<p style="color:var(--text-dim);font-size:0.8rem;margin:0.25rem 0 0.6rem;">
No declared variables found in this playbook.
</p>
{% endif %}