Ansible 安装
使用 Ansible 自动安装 OpenClaw。
前置条件
安装 Ansible:
bash
pip install ansiblePlaybook
创建 openclaw.yml:
yaml
---
- name: Install OpenClaw
hosts: servers
become: true
vars:
openclaw_version: latest
tasks:
- name: Install Node.js
include_role:
name: geerlingguy.nodejs
- name: Install OpenClaw
npm:
name: openclaw
global: yes
version: "{{ openclaw_version }}"
- name: Create config directory
file:
path: ~/.openclaw/config
state: directory
mode: '0700'
- name: Copy config template
template:
src: templates/config.json.j2
dest: ~/.openclaw/config/config.json
- name: Start OpenClaw daemon
command: openclaw onboard --install-daemon运行
bash
# 本地安装
ansible-playbook openclaw.yml -K
# 远程安装
ansible-playbook openclaw.yml -K -i inventory.ini配置模板
json
{
"channels": {
"enabled": ["{{ enable_channels | join('", "') }}"]
},
"models": {
"provider": "{{ model_provider }}"
}
}