42f7840c26
Extend the playbook metadata convention with a namespaced `# steward:<key>:` comment block: - steward:category — free-text grouping label, shown as a badge in the browse list and on the run form. - steward:confirm — true/yes/1/on marks a playbook destructive; the run form then requires a confirmation tick (required checkbox in the shared vars fragment) before it can launch. sources.discover_playbook_meta() parses description + category + confirm (first match per key; `# description:` still primary, `# steward:description:` alias). discover_playbook_description() now delegates to it. The browse list reads per-playbook meta to show category badges + descriptions; the run-form and playbook-vars fragments render the badge + confirm gate. Bundled playbooks tagged: docker_prune → category maintenance + confirm true; provision/install/update → category host-agent. Docs: docs/reference/playbook-authoring.md updated (keys now implemented) and a quick reference added next to the code at steward/ansible/PLAYBOOK_CONVENTIONS.md. Tests added for category/confirm/alias parsing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
50 lines
2.6 KiB
HTML
50 lines
2.6 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 or category %}
|
|
<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);">
|
|
{% if category %}<span style="display:inline-block;font-size:0.68rem;text-transform:uppercase;letter-spacing:0.04em;
|
|
background:var(--bg-elevated);color:var(--text-dim);border-radius:3px;padding:0.05em 0.45em;margin-right:0.4rem;">{{ category }}</span>{% endif %}
|
|
{{ description }}
|
|
</div>
|
|
{% endif %}
|
|
{% if confirm %}
|
|
<label style="display:flex;align-items:flex-start;gap:0.5rem;background:color-mix(in srgb,var(--red) 10%,var(--bg-elevated));
|
|
border:1px solid color-mix(in srgb,var(--red) 35%,var(--border));border-radius:6px;
|
|
padding:0.6rem 0.8rem;margin:0 0 0.6rem;font-size:0.82rem;font-weight:normal;cursor:pointer;">
|
|
<input type="checkbox" name="confirmed" required style="margin-top:0.15rem;">
|
|
<span><strong style="color:var(--red);">Confirm:</strong> this playbook is marked as making
|
|
significant or destructive changes. Tick to enable running it.</span>
|
|
</label>
|
|
{% 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 %}
|