feat(ai_agent_runtime): add Windows tasks implementation

This commit is contained in:
Haitao Pan 2026-06-21 19:48:52 +08:00
parent 340de0c4d8
commit 284c3c43a3
3 changed files with 29 additions and 4 deletions

View File

@ -2,8 +2,8 @@
- name: Assert AI agent runtime is supported on Debian or Darwin family
ansible.builtin.assert:
that:
- ansible_facts.os_family in ["Debian", "Darwin"]
fail_msg: "roles/ai_agent_runtime currently supports Debian-based and Darwin hosts only."
- ansible_facts.os_family in ["Debian", "Darwin", "Windows"]
fail_msg: "roles/ai_agent_runtime currently supports Debian-based, Darwin, and Windows hosts only."
- name: Install AI agent runtime base packages
ansible.builtin.apt:
@ -15,7 +15,7 @@
DEBIAN_FRONTEND: noninteractive
APT_LISTCHANGES_FRONTEND: none
become: true
when: ansible_os_family != 'Darwin'
when: ansible_os_family == 'Debian'
- name: Configure Node.js runtime
ansible.builtin.include_tasks: nodejs.yml

View File

@ -22,6 +22,7 @@
group: "{{ 'root' if ansible_os_family != 'Darwin' else ('staff' if ansible_os_family == 'Darwin' else xworkspace_console_user) }}"
mode: "0755"
become: "{{ ansible_os_family != 'Darwin' }}"
when: ansible_os_family != 'Windows'
- name: Install global npm packages for AI runtime
ansible.builtin.command:
@ -29,7 +30,9 @@
loop: "{{ ai_agent_runtime_npm_global_packages }}"
register: ai_agent_runtime_npm_global_install
changed_when: "'changed=1' in ai_agent_runtime_npm_global_install.stdout"
when: ai_agent_runtime_npm_global_packages | length > 0
when:
- ai_agent_runtime_npm_global_packages | length > 0
- ansible_os_family != 'Windows'
- name: Install pinned Playwright package for AI runtime
ansible.builtin.command:
@ -39,3 +42,8 @@
when:
- ai_agent_runtime_playwright_enabled | bool
- ai_agent_runtime_playwright_version | length > 0
- ansible_os_family != 'Windows'
- name: Import Windows specific Node.js package tasks
ansible.builtin.import_tasks: windows.yml
when: ansible_os_family == 'Windows'

View File

@ -0,0 +1,17 @@
---
- name: Install global npm packages for AI runtime on Windows
community.windows.win_command:
cmd: "npm install -g {{ item }}"
loop: "{{ ai_agent_runtime_npm_global_packages }}"
register: ai_agent_runtime_npm_global_install_win
changed_when: "'added' in ai_agent_runtime_npm_global_install_win.stdout or 'updated' in ai_agent_runtime_npm_global_install_win.stdout"
when: ai_agent_runtime_npm_global_packages | length > 0
- name: Install pinned Playwright package for AI runtime on Windows
community.windows.win_command:
cmd: "npm install -g playwright@{{ ai_agent_runtime_playwright_version }}"
register: ai_agent_runtime_playwright_install_win
changed_when: "'added' in ai_agent_runtime_playwright_install_win.stdout or 'updated' in ai_agent_runtime_playwright_install_win.stdout"
when:
- ai_agent_runtime_playwright_enabled | bool
- ai_agent_runtime_playwright_version | length > 0