feat: allow a portable LiteLLM Python runtime

This commit is contained in:
Haitao Pan 2026-06-15 15:44:52 +08:00
parent 2243b5d0c8
commit 178664f262
2 changed files with 4 additions and 1 deletions

View File

@ -12,6 +12,8 @@ litellm_package_spec: >-
if ansible_facts.distribution == 'Debian' and ansible_facts.distribution_major_version == '11'
else 'litellm[proxy] @ git+' ~ litellm_source_repo ~ '@' ~ litellm_version
}}
litellm_python_executable: "{{ lookup('ansible.builtin.env', 'LITELLM_PYTHON_EXECUTABLE') | default('python3', true) }}"
litellm_pip_executable: "{{ lookup('ansible.builtin.env', 'LITELLM_PIP_EXECUTABLE') | default('', true) }}"
litellm_listen_host: 127.0.0.1
litellm_listen_port: 4000
litellm_config_dir: /etc/litellm

View File

@ -90,13 +90,14 @@
- "prisma"
- "psycopg2-binary"
extra_args: --break-system-packages
executable: "{{ litellm_pip_executable if litellm_pip_executable | length > 0 else omit }}"
state: present
become: true
become_user: "{{ litellm_service_user }}"
- name: Resolve LiteLLM Python site-packages path
ansible.builtin.shell: |
python3 - <<'PY'
{{ litellm_python_executable | quote }} - <<'PY'
import glob
import os
paths = glob.glob(os.path.expanduser("~/.local/lib/python*/site-packages/litellm/proxy"))