- name: Setup llama.cpp - Vulkan hosts: llamacpp vars: podman_user: "{{ llama_user | default('llama') }}" podman_group: "{{ llama_group | default('llama') }}" podman_extra_groups: "users,video" podman_user_home: "{{ llama_home | default('/home/llama') }}" podman_user_folders: - models - .cache - .cache/llama.cpp podman_pods: - name: llama.cpp repo: image: ghcr.io/ggml-org/llama.cpp:server-vulkan ports: - "0.0.0.0:{{ llama_port | default(8012) }}:8080/tcp" command: - "-t" - "{{ llama_cmd_threads | default('12') }}" - "-np" - "{{ llama_cmd_parallel | default('1') }}" - "-b" - "{{ llama_cmd_batch_size | default('1024') }}" - "-ub" - "{{ llama_cmd_ubatch_size | default('512') }}" - "-fa" - "{{ llama_cmd_flash_attn | default('on') }}" - "-ctk" - "{{ llama_cmd_cache_type_k | default('q4_0') }}" - "-ctv" - "{{ llama_cmd_cache_type_v | default('q4_0') }}" - "-cram" - "{{ llama_cmd_cache_reuse | default('-1') }}" - "-sm" - "{{ llama_cmd_split_mode | default('layer') }}" - "-dev" - "{{ llama_cmd_devices | default('Vulkan1,Vulkan2') }}" - "-ts" - "{{ llama_cmd_tensor_split | default('8,12') }}" - "-fit" - "{{ llama_cmd_fit | default('off') }}" - "-mg" - "{{ llama_cmd_main_gpu | default('1') }}" - "--mmap" - "--models-preset" - "{{ llama_cmd_models_preset_path | default('/models/.router/models.ini') }}" - "--models-max" - "{{ llama_cmd_models_max | default(__llama_models_max__) }}" volumes: - "{{ podman_user_home }}/models:/models:Z" - "{{ podman_user_home }}/.cache:/app/.cache:Z" device: - "nvidia.com/gpu=all" - "/dev/kfd:/dev/kfd:rw" - "/dev/dri:/dev/dri:rw" roles: - llama_models_sync - podman tasks: - name: Query llama router model list ansible.builtin.uri: url: "http://127.0.0.1:{{ llama_port | default(8012) }}/models?reload=1" method: GET status_code: 200 register: __llama_router_models__ changed_when: false when: - llama_models_sync_enabled | default(true) - not (llama_models_dry_run | default(false)) - name: Validate expected model aliases are available in router ansible.builtin.assert: that: - item.name in (__llama_router_models__.json.data | map(attribute='id') | list) fail_msg: "Model name '{{ item.name }}' not present in llama router /models output" loop: "{{ __llama_sync_result__.models | default([]) }}" loop_control: label: "{{ item.name }}" when: - llama_models_sync_enabled | default(true) - not (llama_models_dry_run | default(false))