Skip to content

Commit ff916c6

Browse files
authored
Refactor dependency installation and systemd exec cmd (#9)
* Refactor installation of openwebui in venv: * Include the uusrc.general.uv role from within our openwebui role, instead of from within the playbook. This allows us to use the same variable for venv location everywhere. * No need for the install-dependencies role, just uv pip install openwebui :) * Simplify systemd exec command
1 parent eb63396 commit ff916c6

8 files changed

Lines changed: 18 additions & 36 deletions

File tree

playbook.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@
44
- all
55
- localhost
66
gather_facts: true
7-
vars: {}
87
roles:
9-
- role: uusrc.general.uv
10-
vars:
11-
uv_vens: { path: '/.venv', python: '3.11' }
12-
uv_python_versions: [ '3.11' ]
13-
# uv_become: false
14-
# uv_become_user:
158
- role: ollama-serve
169
vars:
1710
ollama_serve_model: "{{ model }}"

roles/install-dependencies/defaults/main.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

roles/install-dependencies/meta/main.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

roles/install-dependencies/tasks/main.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

roles/install-dependencies/vars/main.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

roles/openwebui/tasks/main.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@
88
name: openwebui
99
system: true
1010
createhome: true
11+
home: "{{ openwebui_home }}"
12+
13+
- name: Install uv
14+
ansible.builtin.include_role:
15+
name: uusrc.general.uv
16+
vars:
17+
uv_venvs:
18+
- path: "{{ openwebui_venv }}"
19+
python: '3.11'
20+
uv_python_versions: [ '3.11' ]
21+
22+
- name: Install openwebui in venv
23+
ansible.builtin.command: uv pip install open-webui
24+
environment:
25+
VIRTUAL_ENV: "{{ openwebui_venv }}"
1126

1227
- name: Place systemd config file
1328
ansible.builtin.template:

roles/openwebui/templates/openwebui-serve.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ WorkingDirectory=/home/openwebui
88
{% for var_name, value in openwebui_env.items() %}
99
Environment="{{ var_name }}={{ value }}"
1010
{% endfor %}
11-
ExecStart=/bin/sh -c 'source /.venv/bin/activate && open-webui serve'
11+
ExecStart={{ openwebui_venv }}/bin/open-webui serve
1212
Restart=always
1313

1414
[Install]

roles/openwebui/vars/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#SPDX-License-Identifier: MIT-0
22
---
33
# vars file for openwebui
4+
openwebui_home: /var/www/openwebui
5+
openwebui_venv: "{{ openwebui_home }}/venv"

0 commit comments

Comments
 (0)