Skip to content

fix(slm): add ansible_name column for proper Ansible targeting (#1814)#1932

Merged
mrveiss merged 3 commits intoDev_new_guifrom
fix/node-ansible-name-1814
Mar 20, 2026
Merged

fix(slm): add ansible_name column for proper Ansible targeting (#1814)#1932
mrveiss merged 3 commits intoDev_new_guifrom
fix/node-ansible-name-1814

Conversation

@mrveiss
Copy link
Owner

@mrveiss mrveiss commented Mar 19, 2026

Summary

Node.hostname stores display names (e.g., 00-SLM-Manager) but the reconciler passes it directly to Ansible --limit, which needs actual inventory hostnames. This caused silent failures in service restart operations (#1789).

Changes

  • models/database.py: Added ansible_name VARCHAR(255) nullable column
  • models/schemas.py: Added ansible_name to NodeCreate, NodeUpdate, NodeResponse
  • api/nodes.py: Store ansible_name during node enrollment (both create paths)
  • services/reconciler.py: Use node.ansible_name or node.ip_address for Ansible --limit (both call sites)
  • migrations/add_node_ansible_name.py: ALTER TABLE migration

Migration

Backward-compatible: ansible_name is nullable. Existing nodes with NULL ansible_name will fall back to IP address for Ansible operations (safer than display name).

Post-merge: Backfill existing nodes

After deploying, run on .19:

UPDATE nodes SET ansible_name = '<inventory_name>' WHERE node_id = '<id>';

Test plan

  • Migration runs without error on .19
  • New node enrollment accepts ansible_name field
  • Reconciler restarts use ansible_name for Ansible limit
  • Nodes without ansible_name fall back to IP address

Closes #1814

Node.hostname stores display names (e.g., '00-SLM-Manager') which
break Ansible --limit operations. This adds an explicit ansible_name
column for Ansible inventory host targeting. The reconciler now uses
ansible_name (with ip_address fallback) instead of hostname when
executing playbooks.
@github-actions
Copy link

github-actions bot commented Mar 19, 2026

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

mrveiss added 2 commits March 19, 2026 15:27
Code review found: migration was not registered in runner.py, and
services.py, tls.py, setup_wizard.py still passed node.hostname
to Ansible --limit. All callers now use ansible_name with IP fallback.
- Add Node.ansible_target property (single source of truth for targeting)
- Fix fact extraction key in services.py to match --limit value
- Replace all inline ansible_name-or-ip patterns with the property
@mrveiss mrveiss merged commit 56eb720 into Dev_new_gui Mar 20, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant