Skip to content

Commit 8123ba8

Browse files
mrveissclaude
andauthored
fix(ansible): auto-detect WSL2 and set correct ai_stack_host per deployment (#3503) (#3516)
* fix(ansible): add AUTOBOT_AI_STACK_HOST/PORT to backend env template (#3503) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ansible): auto-detect WSL2 and set correct ai_stack_host per-host (#3503) Detect WSL2 at deploy time by reading /proc/version on each target host. When the host is WSL2 and backend_ai_stack_host has not been overridden from the default 127.0.0.1, set it to 10.255.255.254 (the WSL2 mirrored networking loopback IP). This ensures every re-provisioning produces a correct AUTOBOT_AI_STACK_HOST in the env file without any manual override. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5db2654 commit 8123ba8

File tree

1 file changed

+22
-0
lines changed
  • autobot-slm-backend/ansible/roles/backend/tasks

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,28 @@
2727
state: present
2828
tags: ['backend', 'users']
2929

30+
# ==========================================================
31+
# WSL2 auto-detection (#3503): 127.0.0.1 is ECONNREFUSED on
32+
# WSL2 mirrored networking — override backend_ai_stack_host
33+
# per-host at deploy time if it has not been explicitly set.
34+
# ==========================================================
35+
- name: "Backend | Read /proc/version to detect WSL2 (#3503)"
36+
ansible.builtin.slurp:
37+
src: /proc/version
38+
register: _proc_version
39+
changed_when: false
40+
failed_when: false
41+
tags: ['backend', 'config']
42+
43+
- name: "Backend | Set backend_ai_stack_host=10.255.255.254 on WSL2 hosts (#3503)"
44+
ansible.builtin.set_fact:
45+
backend_ai_stack_host: "10.255.255.254"
46+
when:
47+
- _proc_version.content is defined
48+
- (_proc_version.content | b64decode | lower) is search('microsoft')
49+
- backend_ai_stack_host == '127.0.0.1'
50+
tags: ['backend', 'config']
51+
3052
# ============================================================
3153
# Per-role env at /etc/autobot/ (#926 Phase 4)
3254
# ============================================================

0 commit comments

Comments
 (0)