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,28 +1,51 @@
|
||||
---
|
||||
- name: Create OpenClaw directories
|
||||
- name: Create OpenClaw compose directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
path: "{{ openclaw_compose_dir }}"
|
||||
state: directory
|
||||
owner: glyptic
|
||||
group: docker
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ openclaw_data_dir }}"
|
||||
tags: [openclaw, automation]
|
||||
tags: [openclaw, margaret]
|
||||
|
||||
- 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:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ openclaw_compose_dir }}/docker-compose.openclaw.yml"
|
||||
dest: "{{ openclaw_compose_dir }}/docker-compose.yml"
|
||||
owner: glyptic
|
||||
group: docker
|
||||
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:
|
||||
project_src: "{{ openclaw_compose_dir }}"
|
||||
files:
|
||||
- docker-compose.openclaw.yml
|
||||
state: present
|
||||
tags: [openclaw, automation]
|
||||
when: margaret_image.images | length > 0
|
||||
tags: [openclaw, margaret]
|
||||
|
||||
Reference in New Issue
Block a user