{# Per-host agent panel — embedded into /hosts/ via HTMX. Self-contained. #} {% set scope = "steward:target:" ~ target.id if target else "" %}

Agent

{% if reg %} {{ 'stale' if stale else 'reporting' }}{% if reg.agent_version %} · v{{ reg.agent_version }}{% endif %} {% if reg.last_seen_at %} · last seen {{ reg.last_seen_at.strftime('%Y-%m-%d %H:%M') }}{% endif %} {% endif %}
{% if reg %} {# ── Installed: at-a-glance metrics + lifecycle ── #}
{% set cpu = hostlvl.get('cpu_pct') %} {% set mem = hostlvl.get('mem_used_pct') %} {% set disk = hostlvl.get('disk_used_pct_worst') %} {% set load1 = hostlvl.get('load_1m') %}
CPU
{{ '%.0f%%'|format(cpu) if cpu is not none else '—' }}
Memory
{{ '%.0f%%'|format(mem) if mem is not none else '—' }}
Disk (worst)
{{ '%.0f%%'|format(disk) if disk is not none else '—' }}
Load 1m
{{ '%.2f'|format(load1) if load1 is not none else '—' }}
Full metrics → {% if session.user_role == 'admin' %} {% if ansible_available and target %}
{% endif %}
{% endif %}
{% if ansible_available and not target %}

Link an Ansible target (above) to enable one-click agent updates.

{% endif %} {% else %} {# ── Not installed: provisioning path ── #}

No agent installed. The agent reports CPU, memory, disk, network and more back to Steward.

{% if session.user_role != 'admin' %}

An admin can install the agent here.

{% elif not ansible_available %}

Ansible isn't available, so the agent can't be deployed from here. Install it manually with the curl install command.

{% elif not managed_key_set %}
No managed SSH key yet — Steward needs one to log into hosts.
{% elif not target %}

Link or create an Ansible target for this host (in the Ansible section below) first — provisioning needs an SSH connection.

{% else %}

Deploys the agent to {{ target.name }} by running an Ansible playbook. Steward mints the host's API token automatically; you'll watch the run live.

{# Provision: brand-new host (creates steward account + key over a one-time password) #}
Provision (first contact — fresh host):
{# Install: host already has the steward account (managed key works) #}
Already provisioned?
{% endif %} {% endif %}