diff --git a/plugins/host_agent/templates/panel.html b/plugins/host_agent/templates/panel.html index 33fcd8d..9982ca3 100644 --- a/plugins/host_agent/templates/panel.html +++ b/plugins/host_agent/templates/panel.html @@ -71,6 +71,29 @@

{% endif %} + {% if session.user_role == 'admin' and ansible_available and target and managed_key_set %} +
+ Re-provision (reinstall the steward account + managed key, then the agent) +

+ Use after regenerating the managed key, or if SSH auth as steward breaks. + Connects over a one-time bootstrap user + password (not stored). +

+
+ +
+ + +
+
+ + +
+ +
+
+ {% endif %} + {% else %} {# ── Not reporting: pending (token minted, no check-in) or never installed ── #} {% if reg %} diff --git a/steward/hosts/routes.py b/steward/hosts/routes.py index 804ffda..f0c3a2d 100644 --- a/steward/hosts/routes.py +++ b/steward/hosts/routes.py @@ -304,38 +304,16 @@ async def create_host(): @hosts_bp.get("//edit") @require_role(UserRole.operator) async def edit_host(host_id: str): - from steward.models.ansible_inventory import AnsibleTarget - from sqlalchemy.orm import selectinload - + # Pure host config (name/address/monitors). Agent, Ansible target linking, + # and playbook runs live on the host detail page (the hub), not here. async with current_app.db_sessionmaker() as db: result = await db.execute(select(Host).where(Host.id == host_id)) host = result.scalar_one_or_none() if host is None: return "Not found", 404 - linked_result = await db.execute( - select(AnsibleTarget) - .where(AnsibleTarget.host_id == host_id) - .options(selectinload(AnsibleTarget.groups)) - ) - linked_target = linked_result.scalar_one_or_none() - - # Only show targets not yet linked to any host (plus the currently linked one) - linkable_result = await db.execute( - select(AnsibleTarget) - .where(AnsibleTarget.host_id.is_(None)) - .order_by(AnsibleTarget.name) - ) - linkable_targets = linkable_result.scalars().all() - return await render_template( - "hosts/form.html", - host=host, - probe_types=list(ProbeType), - ansible_sources=_ansible_source_names(), - linked_target=linked_target, - linkable_targets=linkable_targets, - ) + "hosts/form.html", host=host, probe_types=list(ProbeType)) @hosts_bp.post("/") diff --git a/steward/templates/hosts/form.html b/steward/templates/hosts/form.html index e39507c..d6124b7 100644 --- a/steward/templates/hosts/form.html +++ b/steward/templates/hosts/form.html @@ -51,90 +51,11 @@ - - {% if host and ansible_sources %} -
-

Run Ansible playbook against this host

-

- Runs against an ephemeral one-host inventory for - {{ host.name }} ({{ host.address or "no address — resolves by name" }}). - Use a playbook with hosts: all. -

-
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- -
-
- {% endif %} - - -{% if host %} -
-

Ansible Target

- {% if linked_target %} -
-
- {{ linked_target.name }} - {{ linked_target.address }} - {% if linked_target.groups %} -
- {% for grp in linked_target.groups %} - {{ grp.name }} - {% endfor %} -
- {% endif %} -
- Edit Target -
- - -
-
- {% else %} -

- No Ansible target linked. Link an existing target or create one from this host. + {% if host %} +

+ Agent, Ansible target, and playbook runs live on the + host page.

-
- {% if linkable_targets %} -
- - - -
- {% endif %} -
- - -
-
{% endif %}
-{% endif %} {% endblock %}