Files
FabledSteward/steward/templates/ansible/_playbook_vars.html
T
bvandeusen ad726e65f3
CI / lint (push) Successful in 2s
CI / unit (push) Successful in 8s
CI / integration (push) Successful in 2m17s
CI / publish (push) Successful in 43s
feat(ansible): dropdown playbook selection + auto-populated variable fields
Stop making operators type playbook paths and guess extra-var names.

- Reusable infra: shared ansible/_playbook_vars.html (the discovered-variable
  fields) + ansible/_playbook_options.html; two HTMX endpoints —
  /ansible/playbook-options (a source's playbooks, optional ?selected for edit)
  and /ansible/playbook-vars (a playbook's vars:/vars_prompt: as fill-in
  fields). browse _run_form.html refactored to include the shared partial.
- Host "Run a playbook against this host": source dropdown → playbook dropdown
  → variable fields, all chained via HTMX. Handler reuses _parse_run_params so
  var__/secret__ fields flow through extra_vars_map + the unpersisted
  secret_vars channel.
- Schedules: playbook free-text+datalist → source-dependent dropdown; fixed the
  extra-vars edit pre-fill to read extra_vars_map (stale list key after the
  earlier JSON-extra-vars change).

Scribe #895.

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

33 lines
1.5 KiB
HTML

{# Discovered playbook variables as fill-in fields. Shared by the browse run
form, the host run form, and the schedule form. Expects `variables` (from
discover_playbook_variables). Rendered standalone by /ansible/playbook-vars. #}
{% 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 %}