Files
FabledSteward/steward/templates/settings/ansible.html
T
bvandeusenandClaude Opus 5.5 24700ee608
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 56s
CI / unit (push) Successful in 1m24s
CI / publish (push) Successful in 1m9s
feat(settings): Settings brought into line with the rest of Steward (milestone 493)
The last page of #5214's walk. Settings still described Steward as it was
before monitors were unified and SNMP was rebuilt, drew its tabs below the
breadcrumb, and showed the report schedule in UTC.

- Tabs (#5377): settings/_tabs.html is a settings_tabs() macro called in
  each page's section_tabs block, above the trail, as Ansible's are. The
  breadcrumb guard also fails any page that {% include %}s a tab strip.
- Report time (#5378): reports.schedule_tz keeps the zone of whoever saved
  the schedule; check_and_send compares in it (report_due), and the form shows
  the day and hour on the reader's clock (schedule_in) under their zone's
  name. "Last sent" uses |when.
- Wording (#5379): the report contents list what the report holds (monitors,
  not ping-enabled hosts); "Ping latency" is "Response time" and says what it
  grades; plugin detail says enabling loads now and disabling needs a
  restart; the monitor interval says it applies on the next check (the
  scheduler reads it every pass); the dead list-config branch is gone.
- Traefik (#5380): the 5xx and 4xx cutoffs are settings
  (traefik.threshold.error_5xx_pct 0.1, error_4xx_pct 1.0) in a "Traefik
  routers" group on Thresholds while the plugin runs, read by router_state
  through error_cutoffs(). The Traefik page has a Thresholds button for
  admins, to /settings/thresholds/#traefik.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 13:28:43 -04:00

112 lines
6.5 KiB
HTML

{# steward/templates/settings/ansible.html #}
{% extends "base.html" %}
{% from "_macros.html" import crumbs %}
{% block title %}Settings — Ansible — Steward{% endblock %}
{% from "settings/_tabs.html" import settings_tabs %}
{% block section_tabs %}{{ settings_tabs("ansible") }}{% endblock %}
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Ansible", "")]) }}{% endblock %}
{% block content %}
<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>' %}
{# ── Managed identity (provisioning) ───────────────────────────────────────── #}
<div style="margin-top:2.25rem;">
<div class="section-title" style="margin-bottom:0.75rem;">Managed SSH identity</div>
<p style="color:var(--text-muted);font-size:0.84rem;margin-bottom:1rem;">
Steward's reusable Ansible identity. Provisioning installs the <strong>public</strong>
key into each host's <code>{{ ssh_user }}</code> account; steady-state runs authenticate
with the private half (stored encrypted). Generate it once, then provision hosts from
<a href="/plugins/host_agent/fleet/">Host Agents</a>.
</p>
{% if ssh_public_key %}
<div class="form-group">
<label>Public key <span style="color:var(--green);font-size:0.72rem;">(active)</span></label>
<textarea readonly rows="3" onclick="this.select();"
style="width:100%;font-family:ui-monospace,monospace;font-size:0.78rem;color:var(--text-muted);">{{ ssh_public_key }}</textarea>
<span style="color:var(--text-muted);font-size:0.78rem;">Click to select — add to a host's <code>authorized_keys</code> to authorize Steward manually.</span>
</div>
<form method="post" action="/settings/ansible/generate-key"
data-confirm="Regenerate the managed key? Already-provisioned hosts will reject Steward until you re-provision them.">{{ csrf_field() }}
<button type="submit" class="btn btn-ghost btn-sm">Regenerate key</button>
</form>
{% else %}
<form method="post" action="/settings/ansible/generate-key">{{ csrf_field() }}
<button type="submit" class="btn">Generate managed key</button>
<span style="color:var(--text-muted);font-size:0.78rem;margin-left:0.5rem;">ed25519 — created server-side, nothing to paste.</span>
</form>
{% endif %}
</div>
<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">{{ csrf_field() }}
<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>SSH user
<span style="color:var(--text-muted);font-size:0.78rem;font-weight:normal;">(default login for runs; a target's ansible_user overrides)</span>
</label>
<input type="text" name="ssh_user" value="{{ ssh_user }}" placeholder="steward" style="width:12rem;">
</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 %}