Files
FabledSteward/steward/templates/ansible/_run_form.html
T
bvandeusenandClaude Opus 5.5 72a3261582
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 55s
CI / unit (push) Failing after 1m20s
CI / publish (push) Skipped
feat(ansible): Playbooks as one list, and a page per playbook that runs it (#5331, #5330)
- /ansible/playbooks lists every playbook across sources: what it says it
  does, its category and destructive flag, how it last ran; the whole row
  opens the playbook. A source with none is one quiet line.
- /ansible/playbooks/<source>/<path>: the verdict (what it does, flagged
  destructive, last ran), the run form in place (dry run beside the button,
  options folded), the schedules that use it, its recent runs, the playbook
  itself folded. ?from=<run> fills the form from that run: Run again on a
  run's page.
- /ansible/browse, its view page and the /run-form fragment are gone, not
  redirected (rule 122); every link points at the new pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 23:49:05 -04:00

63 lines
3.3 KiB
HTML

{# ansible/_run_form.html — the form that runs one playbook, on its page
(#5331): where to run it, its declared variables, more options folded
away, and the dry-run choice beside the button. `prefill` holds an earlier
run's choices ("Run again"); the run starts in place, under the form. #}
<form id="run-form" class="run-form" hx-post="/ansible/runs" hx-target="#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 for="run-scope">Run against</label>
<select id="run-scope" name="inventory_scope">
{% if targets %}
<option value="steward:all"{% if prefill.scope == 'steward:all' %} selected{% endif %}>All targets ({{ targets | length }})</option>
{% if groups %}
<optgroup label="Group">
{% for grp in groups %}{% set v = "steward:group:" ~ grp.id %}<option value="{{ v }}"{% if prefill.scope == v %} selected{% endif %}>Group: {{ grp.name }}</option>{% endfor %}
</optgroup>
{% endif %}
<optgroup label="Single target">
{% for tgt in targets %}{% set v = "steward:target:" ~ tgt.id %}<option value="{{ v }}"{% if prefill.scope == v %} selected{% endif %}>{{ tgt.name }}</option>{% endfor %}
</optgroup>
{% endif %}
{% if inventories %}
<optgroup label="Inventory file in {{ source_name }}">
{% for inv in inventories %}{% set v = "repo:" ~ source_name ~ ":" ~ inv %}<option value="{{ v }}"{% if prefill.scope == v %} selected{% endif %}>{{ source_name }}/{{ inv }}</option>{% endfor %}
</optgroup>
{% endif %}
{% if not targets and not inventories %}
<option value="" disabled selected>Nothing to run against yet: add a target under Inventory</option>
{% endif %}
</select>
</div>
{% with description="", category="", values=prefill["values"] %}{% include "ansible/_playbook_vars.html" %}{% endwith %}
<details class="run-more"{% if prefill.extra or prefill.limit or prefill.tags %} open{% endif %}>
<summary>More options</summary>
<div class="form-group">
<label for="run-extra">Extra vars <span class="field-hint">one key=value per line</span></label>
<textarea id="run-extra" name="extra_vars" rows="2" class="mono" placeholder="custom_var=value">{{ prefill.extra }}</textarea>
</div>
<div class="form-pair">
<div class="form-group">
<label for="run-limit">Only these hosts <span class="field-hint">--limit</span></label>
<input id="run-limit" type="text" name="limit" value="{{ prefill.limit }}" placeholder="web01,db*">
</div>
<div class="form-group">
<label for="run-tags">Only these tags <span class="field-hint">--tags</span></label>
<input id="run-tags" type="text" name="tags" value="{{ prefill.tags }}" placeholder="deploy,config">
</div>
</div>
</details>
<div class="form-actions">
<button type="submit" class="btn">Run</button>
<label class="field-check">
<input type="checkbox" name="check"{% if prefill.check %} checked{% endif %}>
Dry run: show what would change, change nothing
</label>
</div>
</form>
<div id="run-result"></div>