llm, finish the open-webui setup, start using the workstation config variables.

This commit is contained in:
me
2026-10-10 04:20:28 -07:00
parent a866a6d2e5
commit daec9237f0
+98 -29
View File
@@ -26,12 +26,25 @@
- name: Workstation | Linux | Software | LLMs - name: Workstation | Linux | Software | LLMs
block: block:
- name: Workstation | Linux | Software | LLMs | Facts | Provisioned
debug:
var: "{{ item }}"
loop:
- ollama_enabled
- manage_models
- zeroclaw_enabled
- open_webui_enabled
- open_webui_port
- codium_config
- name: Workstation | Linux | Software | LLMs | Facts 01 - name: Workstation | Linux | Software | LLMs | Facts 01
ansible.builtin.set_fact: ansible.builtin.set_fact:
ollama: ollama ollama: ollama
zeroclaw: zeroclaw zeroclaw: zeroclaw
zerocode: zerocode zerocode: zerocode
qwen_code: qwen-code qwen_code: qwen-code
dummy_service: 'cronie'
dummy_website: 'https://hyperling.com'
# Good to keep low to prevent swap usage. # Good to keep low to prevent swap usage.
llm_concurrency: "{{ (ansible_memtotal_mb / 64000) | round(0, method='ceil') | int }}" llm_concurrency: "{{ (ansible_memtotal_mb / 64000) | round(0, method='ceil') | int }}"
# Allow having multiple chats open without them just waiting each other. # Allow having multiple chats open without them just waiting each other.
@@ -147,8 +160,8 @@
- name: Workstation | Linux | Software | LLMs | Packages | Install - name: Workstation | Linux | Software | LLMs | Packages | Install
ansible.builtin.package: ansible.builtin.package:
name: name:
- "{{ zeroclaw }}"
- "{{ ollama }}" - "{{ ollama }}"
- "{{ zeroclaw }}"
- "{{ zerocode }}" - "{{ zerocode }}"
- "{{ qwen_code }}" - "{{ qwen_code }}"
state: present state: present
@@ -273,7 +286,8 @@
mode: "0755" mode: "0755"
- block: - name: Workstation | Linux | Software | LLMs | runit | open-webui
block:
- name: Workstation | Linux | Software | LLMs | runit | open-webui | Packages - name: Workstation | Linux | Software | LLMs | runit | open-webui | Packages
ansible.builtin.package: ansible.builtin.package:
@@ -288,21 +302,14 @@
state: present state: present
when: ansible_pkg_mgr == "pacman" when: ansible_pkg_mgr == "pacman"
- name: Workstation | Linux | Software | LLMs | runit | open-webui | Dir | Run - name: Workstation | Linux | Software | LLMs | runit | open-webui | Dir | /etc/sv
ansible.builtin.file:
name: "/etc/sv/open_webui"
state: directory
owner: root
mode: "0755"
- name: Workstation | Linux | Software | LLMs | runit | open-webui | Dir | Log
ansible.builtin.file: ansible.builtin.file:
name: "/etc/sv/open_webui/log" name: "/etc/sv/open_webui/log"
state: directory state: directory
owner: root owner: root
mode: "0755" mode: "0755"
- name: Workstation | Linux | Software | LLMs | runit | open-webui | Dir | Log Config - name: Workstation | Linux | Software | LLMs | runit | open-webui | Dir | /var/log
ansible.builtin.file: ansible.builtin.file:
name: "/var/log/open_webui" name: "/var/log/open_webui"
state: directory state: directory
@@ -313,21 +320,52 @@
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/sv/open_webui/run dest: /etc/sv/open_webui/run
content: | content: |
#!/bin/sh -e #!/bin/sh
exec 2>&1
# Wait for Docker to start up. # Wait for Docker to start up.
while [ ! -S /var/run/docker.sock ]; do sleep 1; done while [ ! -S /var/run/docker.sock ]; do sleep 1; done
# Ensure the old container is gone.
echo "Stopping..."
docker stop open-webui &&
echo "Container stopped" ||
echo "Container already stopped."
echo "Deleting..."
docker rm -f open-webui &&
echo "Container deleted" ||
echo "Container already deleted."
# Start the open-webui program. # Start the open-webui program.
set -e
exec docker run --rm \ exec docker run --rm \
-p 3000:{{ open_webui_port }} \ -p {{ open_webui_port }}:8080 \
--add-host=host.docker.internal:host-gateway \ --add-host=host.docker.internal:host-gateway \
-v open-webui:/app/backend/data \ -v open-webui:/app/backend/data \
-e WEBUI_SECRET_KEY=your-secret-key \ -e WEBUI_SECRET_KEY=7578094558f49cf38be40fc463cc0451 \
-e OLLAMA_BASE_URL=http://host.docker.internal:11434 \ -e OLLAMA_BASE_URL=http://host.docker.internal:11434 \
--name open-webui \ --name open-webui \
ghcr.io/open-webui/open-webui:main ghcr.io/open-webui/open-webui:main
mode: "0755" mode: "0755"
when: open_webui - name: Workstation | Linux | Software | LLMs | runit | open-webui | Script | Log
ansible.builtin.copy:
dest: /etc/sv/open_webui/log/run
content: |
#!/bin/sh -e
exec svlogd -tt /var/log/open_webui
mode: "0755"
- name: Workstation | Linux | Software | LLMs | runit | open-webui | Script | Log Config
ansible.builtin.copy:
dest: /var/log/open_webui/config
content: |
s1000000 # rotate at 1 MB
n5 # keep 5 old files
dateformat %Y-%m-%d_%H-%M-%S # each run gets its own file.
mode: "0755"
when: open_webui_enabled
when: ansible_service_mgr == "runit" when: ansible_service_mgr == "runit"
@@ -337,10 +375,10 @@
state: started state: started
enabled: true enabled: true
loop: loop:
- "{{ ollama }}" - "{{ ollama if ollama_enabled else dummy_service }}"
- "{{ zeroclaw }}" - "{{ zeroclaw if zeroclaw_enabled else dummy_service }}"
- "docker" - "{{ 'docker' if open_webui_enabled else dummy_service }}"
- "open_webui" - "{{ 'open_webui' if open_webui_enabled else dummy_service }}"
- name: Workstation | Linux | Software | LLMs | Services | Verify - name: Workstation | Linux | Software | LLMs | Services | Verify
ansible.builtin.uri: ansible.builtin.uri:
@@ -352,9 +390,21 @@
retries: 12 retries: 12
delay: 5 delay: 5
loop: loop:
- http://127.0.0.1:11434/ - "{{ 'http://127.0.0.1:11434/' if ollama_enabled else dummy_website }}"
- http://127.0.0.1:42617/health - "{{ 'http://127.0.0.1:42617/health' if zeroclaw_enabled else dummy_website }}"
- http://127.0.0.1:3000
- name: Workstation | Linux | Software | LLMs | Services | Verify | Okay to Fail
ansible.builtin.uri:
url: "{{ item }}"
status_code: 200
timeout: 5
register: health
until: health.status == 200
retries: 12
delay: 5
loop:
- "{{ 'http://127.0.0.1:3000/health' if open_webui_enabled else dummy_website }}"
ignore_errors: true
#- name: Workstation | Linux | Software | LLMs | Config | zeroclaw | Root #- name: Workstation | Linux | Software | LLMs | Config | zeroclaw | Root
# ansible.builtin.blockinfile: # ansible.builtin.blockinfile:
@@ -419,14 +469,18 @@
- .bashrc - .bashrc
- .zshrc - .zshrc
- name: Workstation | Linux | Software | LLMs | Models | ollama | Manual Script | Message - name: Workstation | Linux | Software | LLMs | Models | ollama | Manage
block:
- name: Workstation | Linux | Software | LLMs | Models | ollama | Manage | Message
ansible.builtin.debug: ansible.builtin.debug:
msg: <- msg: <-
The next task may take hours, if not days. If you'd like a status bar, The next task may take hours, if not days. If you'd like a status
I highly recommed reloading your RC file and running `pull-models`. bar to know what's being worked on and its progress, I highly
That will give you a much better idea of what's going on. recommed reloading your RC file and running `pull-models`. That
will give you a much better idea of what's going on.
- name: Workstation | Linux | Software | LLMs | Models | ollama | Install - name: Workstation | Linux | Software | LLMs | Models | ollama | Manage | Install
ansible.builtin.shell: | ansible.builtin.shell: |
set -o pipefail set -o pipefail
item='{{ item.model }}' item='{{ item.model }}'
@@ -445,9 +499,10 @@
failed_when: "'FAILED' in shell_check.stdout" failed_when: "'FAILED' in shell_check.stdout"
become: true become: true
become_user: "{{ user }}" become_user: "{{ user }}"
when: llm_installs | length > 0 when: manage_models
and llm_installs | length > 0
- name: Workstation | Linux | Software | LLMs | Models | ollama | Remove - name: Workstation | Linux | Software | LLMs | Models | ollama | Manage | Remove
ansible.builtin.shell: | ansible.builtin.shell: |
set -o pipefail set -o pipefail
item='{{ item.model }}' item='{{ item.model }}'
@@ -468,6 +523,14 @@
become_user: "{{ user }}" become_user: "{{ user }}"
when: llm_removals | length > 0 when: llm_removals | length > 0
when: manage_models
- name: Workstation | Linux | Software | LLMs | Models | ollama | Get Models
ansible.builtin.shell:
cmd: ollama ls | tail -n +2 | awk '{print $1}'
register: llm_models
changed_when: llm_models.rc == 0
# Cheat Sheet: https://docs.zeroclaw.com/master/en/providers/configuration.html # Cheat Sheet: https://docs.zeroclaw.com/master/en/providers/configuration.html
- name: Workstation | Linux | Software | LLMs | Models | zeroclaw | Add Providers - name: Workstation | Linux | Software | LLMs | Models | zeroclaw | Add Providers
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
@@ -476,14 +539,17 @@
insertafter: EOF insertafter: EOF
block: | block: |
{% for llm in llm_installs %} {% for llm in llm_installs %}
{% if llm.model in llm_models %}
[providers.models.ollama.{{ llm.provider }}] [providers.models.ollama.{{ llm.provider }}]
model = "{{ llm.model }}" model = "{{ llm.model }}"
timeout_secs = 3600 # 1 hour, default is 120 (2 minutes), issue happens between 5 and 6 minutes though. timeout_secs = 3600 # 1 hour, default is 120 (2 minutes), issue happens between 5 and 6 minutes though.
context_window = {{ llm_context }} context_window = {{ llm_context }}
{% endif %}
{% endfor %} {% endfor %}
state: present state: present
create: false create: false
backup: true backup: true
when: zeroclaw_enabled
- name: Workstation | Linux | Software | LLMs | Models | Continue | Config - name: Workstation | Linux | Software | LLMs | Models | Continue | Config
ansible.builtin.copy: ansible.builtin.copy:
@@ -495,6 +561,7 @@
schema: v1 schema: v1
models: models:
{% for llm in llm_installs %} {% for llm in llm_installs %}
{% if llm.model in llm_models %}
- name: {{ llm.provider }} - name: {{ llm.provider }}
provider: ollama provider: ollama
model: {{ llm.model }} model: {{ llm.model }}
@@ -509,7 +576,9 @@
maxTokens: {{ llm_context }} maxTokens: {{ llm_context }}
roles: roles:
- autocomplete - autocomplete
{% endif %}
{% endfor %} {% endfor %}
mode: "0644" mode: "0644"
when: codium_config
when: ansible_pkg_mgr == "pacman" when: ansible_pkg_mgr == "pacman"