diff --git a/tasks/workstation/linux/software/zeroclaw.yml b/tasks/workstation/linux/software/zeroclaw.yml index 2e23752..a2bf30b 100644 --- a/tasks/workstation/linux/software/zeroclaw.yml +++ b/tasks/workstation/linux/software/zeroclaw.yml @@ -92,137 +92,131 @@ - "{{ zerocode }}" state: present - - name: Workstation | Linux | Software | ZeroClaw | ollama | runit | Dir | Run - ansible.builtin.file: - name: "{{ ollama_runit_dir }}" - state: directory - owner: root - mode: "0755" + - name: Workstation | Linux | Software | ZeroClaw | runit + block: + + - name: Workstation | Linux | Software | ZeroClaw | runit | ollama | Dir | Run + ansible.builtin.file: + name: "{{ ollama_runit_dir }}" + state: directory + owner: root + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | ollama | Dir | Log Run + ansible.builtin.file: + name: "{{ ollama_runit_log_dir }}" + state: directory + owner: root + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | ollama | Dir | Log Config + ansible.builtin.file: + name: "{{ ollama_runit_log_dest }}" + state: directory + owner: "{{ user }}" + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | ollama | Script | Run + ansible.builtin.copy: + content: | + #!/bin/sh -e + # Allow pulling LLMs for use with ZeroClaw. + exec 2>&1 + export HOME={{ user_user.home }} + export OLLAMA_KEEP_ALIVE=0 # default 5m + export OLLAMA_REQUEST_TIMEOUT=600 # default 300 + export OLLAMA_MAX_LOADED_MODELS=1 # default is 3 if using CPUs, or 3 * NumGPUs + exec chpst -u {{ user }} ollama serve + dest: "{{ ollama_runit_script }}" + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | ollama | Script | Log + ansible.builtin.copy: + content: | + #!/bin/sh -e + exec svlogd -tt {{ ollama_runit_log_dest }} + dest: "{{ ollama_runit_log_script }}" + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | ollama | Script | Log Config + ansible.builtin.copy: + content: | + s10000000 # rotate at 10 MB + n5 # keep 5 old files + dest: "{{ ollama_runit_log_config }}" + owner: "{{ user }}" + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | zeroclaw | Dir | Run + ansible.builtin.file: + name: "{{ zeroclaw_runit_dir }}" + state: directory + owner: root + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | zeroclaw | Dir | Log + ansible.builtin.file: + name: "{{ zeroclaw_runit_log_dir }}" + state: directory + owner: root + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | zeroclaw | Dir | Log Config + ansible.builtin.file: + name: "{{ zeroclaw_runit_log_dest }}" + state: directory + owner: "{{ user }}" + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | zeroclaw | Script | File + ansible.builtin.copy: + content: | + #!/bin/sh -e + # Allow using the ZeroClaw frontend. + exec 2>&1 + exec chpst -u {{ user }} zeroclaw daemon + dest: "{{ zeroclaw_runit_script }}" + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | zeroclaw | Script | Log + ansible.builtin.copy: + content: | + #!/bin/sh -e + exec svlogd -tt {{ zeroclaw_runit_log_dest }} + dest: "{{ zeroclaw_runit_log_script }}" + mode: "0755" + + - name: Workstation | Linux | Software | ZeroClaw | runit | zeroclaw | Script | Log Config + ansible.builtin.copy: + content: | + s1000000 # rotate at 1 MB + n5 # keep 5 old files + dest: "{{ zeroclaw_runit_log_config }}" + mode: "0755" + when: ansible_service_mgr == "runit" - - name: Workstation | Linux | Software | ZeroClaw | ollama | runit | Dir | Log Run - ansible.builtin.file: - name: "{{ ollama_runit_log_dir }}" - state: directory - owner: root - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | ollama | runit | Dir | Log Config - ansible.builtin.file: - name: "{{ ollama_runit_log_dest }}" - state: directory - owner: "{{ user }}" - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | ollama | runit | Script | Run - ansible.builtin.copy: - content: | - #!/bin/sh -e - # Allow pulling LLMs for use with ZeroClaw. - exec 2>&1 - export HOME={{ user_user.home }} - export OLLAMA_KEEP_ALIVE=-1 - export OLLAMA_MAX_LOADED_MODELS=1 - exec chpst -u {{ user }} ollama serve - dest: "{{ ollama_runit_script }}" - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | ollama | runit | Script | Log - ansible.builtin.copy: - content: | - #!/bin/sh -e - exec svlogd -tt {{ ollama_runit_log_dest }} - dest: "{{ ollama_runit_log_script }}" - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | ollama | runit | Script | Log Config - ansible.builtin.copy: - content: | - s10000000 # rotate at 10 MB - n5 # keep 5 old files - dest: "{{ ollama_runit_log_config }}" - owner: "{{ user }}" - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | ollama | Enable + - name: Workstation | Linux | Software | ZeroClaw | Enable ansible.builtin.service: - name: "{{ ollama }}" + name: "{{ item }}" state: started enabled: true + loop: + - "{{ ollama }}" + - "{{ zeroclaw }}" - - name: Workstation | Linux | Software | ZeroClaw | zeroclaw | runit | Dir | Run - ansible.builtin.file: - name: "{{ zeroclaw_runit_dir }}" - state: directory - owner: root - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | zeroclaw | runit | Dir | Log - ansible.builtin.file: - name: "{{ zeroclaw_runit_log_dir }}" - state: directory - owner: root - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | zeroclaw | runit | Dir | Log Config - ansible.builtin.file: - name: "{{ zeroclaw_runit_log_dest }}" - state: directory - owner: "{{ user }}" - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | zeroclaw | runit | Script | File - ansible.builtin.copy: - content: | - #!/bin/sh -e - # Allow using the ZeroClaw frontend. - exec 2>&1 - exec chpst -u {{ user }} zeroclaw daemon - dest: "{{ zeroclaw_runit_script }}" - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | zeroclaw | runit | Script | Log - ansible.builtin.copy: - content: | - #!/bin/sh -e - exec svlogd -tt {{ zeroclaw_runit_log_dest }} - dest: "{{ zeroclaw_runit_log_script }}" - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | zeroclaw | runit | Script | Log Config - ansible.builtin.copy: - content: | - s1000000 # rotate at 1 MB - n5 # keep 5 old files - dest: "{{ zeroclaw_runit_log_config }}" - mode: "0755" - when: ansible_service_mgr == "runit" - - - name: Workstation | Linux | Software | ZeroClaw | zeroclaw | Enable - ansible.builtin.service: - name: "{{ zeroclaw }}" - state: started - enabled: true - - - name: Workstation | Linux | Software | ZeroClaw | ollama | Wait + - name: Workstation | Linux | Software | ZeroClaw | Verify ansible.builtin.uri: - url: http://127.0.0.1:11434/ + url: "{{ item }}" status_code: 200 timeout: 5 register: health until: health.status == 200 retries: 12 delay: 5 + loop: + - http://127.0.0.1:11434/ + - http://127.0.0.1:42617/health - name: Workstation | Linux | Software | ZeroClaw | ollama | Models | Install ansible.builtin.shell: | @@ -264,14 +258,4 @@ become: true become_user: "{{ user }}" - - name: Workstation | Linux | Software | ZeroClaw | zeroclaw | Wait - ansible.builtin.uri: - url: http://127.0.0.1:42617/health - status_code: 200 - timeout: 5 - register: health - until: health.status == 200 - retries: 12 - delay: 5 - when: ansible_pkg_mgr == "pacman"