88857be24e
Closes #550 (all four): - Cancellation: track live subprocesses; POST /ansible/runs/<id>/cancel (operator) SIGTERMs then SIGKILLs after a grace; new 'cancelled' status (+ migration 0019, ALTER TYPE in autocommit). Queued runs cancel cleanly before launch. Cancel button on run detail. - Concurrency: global semaphore (ansible.max_concurrent_runs, default 3, Settings→Ansible) caps simultaneous runs; excess show 'queued' (new status) until a slot frees. Semaphore bound lazily per running loop. - Structured results: parse PLAY RECAP into per-host ok/changed/unreachable/ failed/skipped + capture failed-task lines, stored in new results JSON column (migration 0020); rendered as a host-summary table on run detail. Keeps live streaming (no json-callback swap). - Retention: full output written to a persistent log artifact (/data/ansible/runs/<id>.log, env-overridable) beyond the 1 MB DB cap and across restarts; in-memory replay buffer bounded + GC'd after completion; Download-log route. Boot reconciliation now also sweeps stale 'queued'. Unit tests for recap parsing + cancel flagging. Status colors updated across run list / detail / schedules. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
77 lines
4.2 KiB
HTML
77 lines
4.2 KiB
HTML
{# steward/templates/settings/ansible.html #}
|
|
{% extends "base.html" %}
|
|
{% from "_macros.html" import crumbs %}
|
|
{% block title %}Settings — Ansible — Steward{% endblock %}
|
|
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Ansible", "")]) }}{% endblock %}
|
|
{% block content %}
|
|
{% set active_tab = "ansible" %}
|
|
{% include "settings/_tabs.html" %}
|
|
|
|
<div style="max-width:720px;">
|
|
<div style="display:flex;align-items:baseline;justify-content:space-between;margin-bottom:0.75rem;">
|
|
<div class="section-title">Ansible Sources</div>
|
|
<a href="/ansible/" class="btn btn-ghost btn-sm" style="font-size:0.78rem;">Run History →</a>
|
|
</div>
|
|
<p style="color:var(--text-muted);font-size:0.84rem;margin-bottom:1rem;">
|
|
Sources are directories of playbooks — either a local path or a git repository
|
|
cloned automatically. Add as many as you need; each can be browsed and run independently.
|
|
</p>
|
|
{% include "settings/_ansible_sources.html" %}
|
|
|
|
{# ── Credentials ──────────────────────────────────────────────────────────── #}
|
|
{% set cfg_badge = '<span style="color:var(--green);font-size:0.72rem;">(configured)</span>' %}
|
|
{% set not_set_badge = '<span style="color:var(--text-muted);font-size:0.72rem;">(not set)</span>' %}
|
|
<div style="margin-top:2.25rem;">
|
|
<div class="section-title" style="margin-bottom:0.75rem;">Credentials</div>
|
|
<p style="color:var(--text-muted);font-size:0.84rem;margin-bottom:1rem;">
|
|
Used by every playbook run (manual and alert-triggered). Stored on the server and
|
|
never shown again after saving — leave a field blank to keep the current value.
|
|
</p>
|
|
<form method="post" action="/settings/ansible/credentials">
|
|
<div class="form-group">
|
|
<label>SSH private key {{ (cfg_badge if ssh_key_set else not_set_badge) | safe }}</label>
|
|
<textarea name="ssh_private_key" rows="4"
|
|
placeholder="-----BEGIN OPENSSH PRIVATE KEY----- … (blank = keep current)"
|
|
style="width:100%;font-family:ui-monospace,monospace;font-size:0.8rem;"></textarea>
|
|
{% if ssh_key_set %}
|
|
<label style="font-weight:normal;font-size:0.8rem;color:var(--text-muted);">
|
|
<input type="checkbox" name="clear_ssh_private_key"> Clear stored key</label>
|
|
{% endif %}
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Become / sudo password {{ (cfg_badge if become_set else not_set_badge) | safe }}</label>
|
|
<input type="password" name="become_password" autocomplete="new-password"
|
|
placeholder="blank = keep current">
|
|
{% if become_set %}
|
|
<label style="font-weight:normal;font-size:0.8rem;color:var(--text-muted);">
|
|
<input type="checkbox" name="clear_become_password"> Clear</label>
|
|
{% endif %}
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Vault password {{ (cfg_badge if vault_set else not_set_badge) | safe }}</label>
|
|
<input type="password" name="vault_password" autocomplete="new-password"
|
|
placeholder="blank = keep current">
|
|
{% if vault_set %}
|
|
<label style="font-weight:normal;font-size:0.8rem;color:var(--text-muted);">
|
|
<input type="checkbox" name="clear_vault_password"> Clear</label>
|
|
{% endif %}
|
|
</div>
|
|
<div class="form-group">
|
|
<label style="display:flex;align-items:center;gap:0.5rem;font-weight:normal;">
|
|
<input type="checkbox" name="host_key_checking" {% if host_key_checking %}checked{% endif %}>
|
|
Enforce SSH host-key checking <span style="color:var(--text-muted);font-size:0.78rem;">(off by default for homelab convenience)</span>
|
|
</label>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Max concurrent runs
|
|
<span style="color:var(--text-muted);font-size:0.78rem;font-weight:normal;">(extra runs queue; applied on restart)</span>
|
|
</label>
|
|
<input type="number" name="max_concurrent_runs" min="1" max="50"
|
|
value="{{ max_concurrent_runs }}" style="width:7rem;">
|
|
</div>
|
|
<button type="submit" class="btn">Save credentials</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|