zeroclaw, refactor runit section into a block as well as service and wait into loops.
This commit is contained in:
@@ -92,137 +92,131 @@
|
|||||||
- "{{ zerocode }}"
|
- "{{ zerocode }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Workstation | Linux | Software | ZeroClaw | ollama | runit | Dir | Run
|
- name: Workstation | Linux | Software | ZeroClaw | runit
|
||||||
ansible.builtin.file:
|
block:
|
||||||
name: "{{ ollama_runit_dir }}"
|
|
||||||
state: directory
|
- name: Workstation | Linux | Software | ZeroClaw | runit | ollama | Dir | Run
|
||||||
owner: root
|
ansible.builtin.file:
|
||||||
mode: "0755"
|
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"
|
when: ansible_service_mgr == "runit"
|
||||||
|
|
||||||
- name: Workstation | Linux | Software | ZeroClaw | ollama | runit | Dir | Log Run
|
- name: Workstation | Linux | Software | ZeroClaw | Enable
|
||||||
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
|
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: "{{ ollama }}"
|
name: "{{ item }}"
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
loop:
|
||||||
|
- "{{ ollama }}"
|
||||||
|
- "{{ zeroclaw }}"
|
||||||
|
|
||||||
- name: Workstation | Linux | Software | ZeroClaw | zeroclaw | runit | Dir | Run
|
- name: Workstation | Linux | Software | ZeroClaw | Verify
|
||||||
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
|
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: http://127.0.0.1:11434/
|
url: "{{ item }}"
|
||||||
status_code: 200
|
status_code: 200
|
||||||
timeout: 5
|
timeout: 5
|
||||||
register: health
|
register: health
|
||||||
until: health.status == 200
|
until: health.status == 200
|
||||||
retries: 12
|
retries: 12
|
||||||
delay: 5
|
delay: 5
|
||||||
|
loop:
|
||||||
|
- http://127.0.0.1:11434/
|
||||||
|
- http://127.0.0.1:42617/health
|
||||||
|
|
||||||
- name: Workstation | Linux | Software | ZeroClaw | ollama | Models | Install
|
- name: Workstation | Linux | Software | ZeroClaw | ollama | Models | Install
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
@@ -264,14 +258,4 @@
|
|||||||
become: true
|
become: true
|
||||||
become_user: "{{ user }}"
|
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"
|
when: ansible_pkg_mgr == "pacman"
|
||||||
|
|||||||
Reference in New Issue
Block a user