Skip to content

Commit fbaec25

Browse files
mrveissclaude
andcommitted
refactor(ai-stack): unified service account to autobot:autobot (#4091)
All AutoBot services on a host now use the same autobot:autobot account, eliminating the confusing split between backend (autobot) and ai-stack (autobot-ai). Changes: - ai-stack role defaults: ai_user/ai_group now 'autobot' instead of 'autobot-ai' - ai_data_dir changed from /var/lib/autobot-ai to /var/lib/autobot (shared) - Removed separate autobot-ai account creation in ai-stack tasks - Removed ai_user/ai_group override in setup_wizard auto-inject Benefits: - Simpler permissions and ownership model - No permission conflicts during co-location - Consistent with backend service model - Eliminates need for auto-inject overrides Related: #3501, #3097, #4088 (EnvironmentFile fix) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent f9b8f37 commit fbaec25

File tree

3 files changed

+14
-32
lines changed

3 files changed

+14
-32
lines changed

autobot-slm-backend/ansible/roles/ai-stack/defaults/main.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
# Copyright (c) 2025 mrveiss
33
# Author: mrveiss
44
---
5-
# AI Stack configuration defaults (#926 Phase 4: per-role account + scoped dir)
6-
ai_service_account: autobot-ai
7-
ai_user: autobot-ai
8-
ai_group: autobot-ai
5+
# AI Stack configuration defaults (#926 Phase 4: unified service account)
6+
# All AutoBot services on a host use autobot:autobot regardless of role (#4091).
7+
# This simplifies permissions and avoids ownership conflicts during co-location.
8+
ai_service_account: autobot
9+
ai_user: autobot
10+
ai_group: autobot
911
ai_install_dir: /opt/autobot/autobot-ai-stack
1012
ai_log_dir: /var/log/autobot
11-
# Issue #3097: ai-stack gets its own /var/lib/autobot-ai to avoid ownership
12-
# conflict with /var/lib/autobot (owned by autobot:autobot for the backend).
13-
ai_data_dir: /var/lib/autobot-ai
13+
# Issue #3097: ai-stack and backend share /var/lib/autobot for data storage
14+
ai_data_dir: /var/lib/autobot
1415

1516
# Co-located backend (used when ai-stack runs on the same host as autobot-backend)
1617
backend_install_dir: /opt/autobot/autobot-backend
@@ -20,7 +21,7 @@ ai_host: "0.0.0.0"
2021
ai_port: 8080
2122

2223
# ChromaDB
23-
chromadb_persist_dir: /var/lib/autobot-ai/chromadb
24+
chromadb_persist_dir: /var/lib/autobot/chromadb
2425
chromadb_host: "0.0.0.0"
2526
chromadb_port: 8100
2627

autobot-slm-backend/ansible/roles/ai-stack/tasks/main.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,10 @@
1313
tags: ['clean']
1414

1515
# ============================================================
16-
# Per-role service account (#926 Phase 4)
16+
# Service account setup (#926 Phase 4, #4091: unified autobot account)
1717
# ============================================================
18-
- name: "AI Stack | Create autobot-ai system group"
19-
ansible.builtin.group:
20-
name: "{{ ai_group }}"
21-
system: true
22-
state: present
23-
tags: ['ai', 'users']
24-
25-
- name: "AI Stack | Create per-role service account"
26-
ansible.builtin.user:
27-
name: "{{ ai_user }}"
28-
system: true
29-
shell: /usr/sbin/nologin
30-
create_home: false
31-
group: "{{ ai_group }}"
32-
comment: "AutoBot AI stack service account"
33-
state: present
34-
tags: ['ai', 'users']
18+
# AI Stack uses the existing autobot:autobot account created by backend role.
19+
# No separate account creation needed — all AutoBot services share autobot.
3520

3621
# ============================================================
3722
# Per-role env at /etc/autobot/ (#926 Phase 4)

autobot-slm-backend/api/setup_wizard.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,8 @@ def _inject_co_located_ai_stack(
329329
if _ai_stack_roles & set(roles):
330330
continue
331331
hosts[inv_name]["node_roles"] = list(roles) + ["ai-stack"]
332-
# Co-located ai-stack shares the backend venv and symlinks owned by
333-
# autobot:autobot. Override the role's default ai_user/ai_group
334-
# (autobot-ai) so the systemd service runs with the correct identity
335-
# and avoids permission errors on startup (#3501).
336-
hosts[inv_name]["ai_user"] = "autobot"
337-
hosts[inv_name]["ai_group"] = "autobot"
332+
# Note: ai-stack role now defaults to autobot:autobot (not autobot-ai)
333+
# per unified service account model (#4091). No override needed.
338334
injected.append(inv_name)
339335
logger.info(
340336
"Auto-injecting ai-stack onto %s (no dedicated AI stack node in fleet; #3461)",

0 commit comments

Comments
 (0)