ad726e65f3
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>
68 lines
3.3 KiB
HTML
68 lines
3.3 KiB
HTML
{# Run form for a single playbook — loaded via HTMX from /ansible/run-form/… #}
|
|
<div style="background:var(--bg-elevated);border-radius:6px;padding:1rem;border:1px solid var(--border-mid);">
|
|
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:0.75rem;">
|
|
<h4 class="section-title" style="margin-bottom:0;">Run <span style="font-family:ui-monospace,monospace;font-weight:normal;">{{ playbook_path }}</span></h4>
|
|
<a href="#" onclick="this.closest('div[id^=run-form-]').innerHTML='';return false;"
|
|
class="btn btn-ghost btn-sm">Cancel</a>
|
|
</div>
|
|
<form hx-post="/ansible/runs" hx-target="next .run-result" hx-swap="innerHTML">
|
|
<input type="hidden" name="source_name" value="{{ source_name }}">
|
|
<input type="hidden" name="playbook_path" value="{{ playbook_path }}">
|
|
|
|
<div class="form-group">
|
|
<label>Run against</label>
|
|
<select name="inventory_scope">
|
|
{% if targets %}
|
|
<option value="steward:all">All targets ({{ targets | length }})</option>
|
|
{% if groups %}
|
|
<optgroup label="Group">
|
|
{% for grp in groups %}<option value="steward:group:{{ grp.id }}">Group: {{ grp.name }}</option>{% endfor %}
|
|
</optgroup>
|
|
{% endif %}
|
|
<optgroup label="Single target">
|
|
{% for tgt in targets %}<option value="steward:target:{{ tgt.id }}">{{ tgt.name }}</option>{% endfor %}
|
|
</optgroup>
|
|
{% endif %}
|
|
{% if inventories %}
|
|
<optgroup label="Repo inventory file">
|
|
{% for inv in inventories %}<option value="repo:{{ source_name }}:{{ inv }}">{{ source_name }}/{{ inv }}</option>{% endfor %}
|
|
</optgroup>
|
|
{% endif %}
|
|
{% if not targets and not inventories %}
|
|
<option value="" disabled>No targets or inventory files — add targets at /ansible/inventory/targets</option>
|
|
{% endif %}
|
|
</select>
|
|
</div>
|
|
|
|
{% include "ansible/_playbook_vars.html" %}
|
|
|
|
<details style="margin:0.25rem 0 0.75rem;">
|
|
<summary style="cursor:pointer;font-size:0.82rem;color:var(--text-muted);">Advanced</summary>
|
|
<div class="form-group" style="margin-top:0.6rem;">
|
|
<label>Extra vars <span style="color:var(--text-muted);font-weight:normal;">(one key=value per line)</span></label>
|
|
<textarea name="extra_vars" rows="2" placeholder="custom_var=value"
|
|
style="width:100%;font-family:ui-monospace,monospace;font-size:0.85rem;"></textarea>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Limit to host(s) <span style="color:var(--text-muted);font-weight:normal;">(--limit)</span></label>
|
|
<input type="text" name="limit" placeholder="web01,db*">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Tags <span style="color:var(--text-muted);font-weight:normal;">(--tags)</span></label>
|
|
<input type="text" name="tags" placeholder="deploy,config">
|
|
</div>
|
|
<div class="form-group">
|
|
<label style="display:flex;align-items:center;gap:0.5rem;font-weight:normal;">
|
|
<input type="checkbox" name="check">
|
|
Dry-run (--check --diff) — preview changes without applying
|
|
</label>
|
|
</div>
|
|
</details>
|
|
|
|
<div style="display:flex;gap:0.75rem;align-items:center;">
|
|
<button type="submit" class="btn">Execute</button>
|
|
</div>
|
|
</form>
|
|
<div class="run-result" style="margin-top:1rem;"></div>
|
|
</div>
|