Update openclaw role for Margaret Docker deployment
- Updated defaults: custom image, container name, config paths - Updated compose template: proper CMD, HOME env, user mapping - Updated tasks: image existence check, warning if not found - Added handlers: restart on compose changes - Image must be pre-built on Bart (16GB RAM) and transferred
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
---
|
---
|
||||||
openclaw_compose_dir: "{{ docker_compose_base }}/automation"
|
openclaw_compose_dir: "{{ docker_compose_base }}/margaret"
|
||||||
openclaw_data_dir: /data/openclaw
|
openclaw_config_dir: /home/glyptic/.openclaw
|
||||||
openclaw_image: "ghcr.io/openclaw/openclaw:latest"
|
openclaw_image: margaret-openclaw:latest
|
||||||
openclaw_host: "openclaw.{{ domain }}"
|
openclaw_container_name: margaret
|
||||||
|
openclaw_gateway_port: 18790
|
||||||
|
openclaw_matrix_user: margaret
|
||||||
|
openclaw_anthropic_api_key: "{{ vault_anthropic_api_key }}"
|
||||||
|
openclaw_user_uid: "1000"
|
||||||
|
openclaw_user_gid: "1000"
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- name: Restart Margaret
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_src: "{{ openclaw_compose_dir }}"
|
||||||
|
state: restarted
|
||||||
|
tags: [openclaw, margaret]
|
||||||
@@ -1,28 +1,51 @@
|
|||||||
---
|
---
|
||||||
- name: Create OpenClaw directories
|
- name: Create OpenClaw compose directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ item }}"
|
path: "{{ openclaw_compose_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: glyptic
|
owner: glyptic
|
||||||
group: docker
|
group: docker
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
loop:
|
tags: [openclaw, margaret]
|
||||||
- "{{ openclaw_data_dir }}"
|
|
||||||
tags: [openclaw, automation]
|
|
||||||
|
|
||||||
- name: Deploy OpenClaw compose file
|
- name: Ensure OpenClaw config directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ openclaw_config_dir }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ openclaw_user_uid }}"
|
||||||
|
group: "{{ openclaw_user_gid }}"
|
||||||
|
mode: "0755"
|
||||||
|
tags: [openclaw, margaret]
|
||||||
|
|
||||||
|
- name: Deploy OpenClaw (Margaret) compose file
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: docker-compose.yml.j2
|
src: docker-compose.yml.j2
|
||||||
dest: "{{ openclaw_compose_dir }}/docker-compose.openclaw.yml"
|
dest: "{{ openclaw_compose_dir }}/docker-compose.yml"
|
||||||
owner: glyptic
|
owner: glyptic
|
||||||
group: docker
|
group: docker
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
tags: [openclaw, automation]
|
notify: Restart Margaret
|
||||||
|
tags: [openclaw, margaret]
|
||||||
|
|
||||||
- name: Start OpenClaw
|
- name: Check if Margaret image exists
|
||||||
|
community.docker.docker_image_info:
|
||||||
|
name: "{{ openclaw_image }}"
|
||||||
|
register: margaret_image
|
||||||
|
tags: [openclaw, margaret]
|
||||||
|
|
||||||
|
- name: Warn if Margaret image not found
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: >
|
||||||
|
Margaret image '{{ openclaw_image }}' not found locally.
|
||||||
|
Build on Bart (192.168.86.181) and transfer:
|
||||||
|
docker save {{ openclaw_image }} | gzip > /tmp/margaret.tar.gz
|
||||||
|
# Transfer via relay and load on Peggy
|
||||||
|
when: margaret_image.images | length == 0
|
||||||
|
tags: [openclaw, margaret]
|
||||||
|
|
||||||
|
- name: Start Margaret container
|
||||||
community.docker.docker_compose_v2:
|
community.docker.docker_compose_v2:
|
||||||
project_src: "{{ openclaw_compose_dir }}"
|
project_src: "{{ openclaw_compose_dir }}"
|
||||||
files:
|
|
||||||
- docker-compose.openclaw.yml
|
|
||||||
state: present
|
state: present
|
||||||
tags: [openclaw, automation]
|
when: margaret_image.images | length > 0
|
||||||
|
tags: [openclaw, margaret]
|
||||||
|
|||||||
@@ -1,21 +1,24 @@
|
|||||||
services:
|
services:
|
||||||
openclaw:
|
{{ openclaw_container_name }}:
|
||||||
image: {{ openclaw_image }}
|
image: {{ openclaw_image }}
|
||||||
container_name: openclaw
|
container_name: {{ openclaw_container_name }}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
command:
|
||||||
TZ: {{ timezone }}
|
- node
|
||||||
|
- /usr/local/lib/node_modules/openclaw/dist/index.js
|
||||||
|
- gateway
|
||||||
|
- --allow-unconfigured
|
||||||
volumes:
|
volumes:
|
||||||
- {{ openclaw_data_dir }}:/data
|
- {{ openclaw_config_dir }}:/home/glyptic/.openclaw
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
||||||
labels:
|
|
||||||
traefik.enable: "true"
|
|
||||||
traefik.http.routers.openclaw.rule: "Host(`{{ openclaw_host }}`)"
|
|
||||||
traefik.http.routers.openclaw.entrypoints: websecure
|
|
||||||
traefik.http.routers.openclaw.tls.certresolver: letsencrypt
|
|
||||||
traefik.http.services.openclaw.loadbalancer.server.port: "3000"
|
|
||||||
networks:
|
networks:
|
||||||
- {{ docker_network_name }}
|
- {{ docker_network_name }}
|
||||||
|
labels:
|
||||||
|
traefik.enable: "false"
|
||||||
|
environment:
|
||||||
|
NODE_ENV: production
|
||||||
|
HOME: /home/glyptic
|
||||||
|
ANTHROPIC_API_KEY: {{ openclaw_anthropic_api_key }}
|
||||||
|
user: "{{ openclaw_user_uid }}:{{ openclaw_user_gid }}"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
{{ docker_network_name }}:
|
{{ docker_network_name }}:
|
||||||
|
|||||||
Reference in New Issue
Block a user