- nvidia-driver-595-open (already installed 2026-08-03, idempotent) - Python venv + vLLM 0.26.0 (already installed, idempotent) - Gemma 2 27B model download via HuggingFace hub - systemd vllm-serve.service on port 8000 - Hermes provider integration on carousel-of-progress - vault_hf_token added to group_vars/all/vault - ansible.cfg: vault_password_file set to absolute path - inventory: astro_orbiter group added Run with: env -u ANSIBLE_VAULT_PASSWORD_FILE ansible-playbook -i inventory.yml playbooks/day1_deploy_llm_inference.yml
43 lines
1.5 KiB
YAML
43 lines
1.5 KiB
YAML
---
|
|
# ------------------------------------------------------------------------------
|
|
# FILE: roles/llm-inference/tasks/model.yml
|
|
# DESCRIPTION: Phase 4 — HuggingFace login and Gemma 2 27B model download.
|
|
# Idempotent: snapshot_download skips files already present.
|
|
# Requires vault_hf_token and Gemma 2 licence accepted at
|
|
# huggingface.co/google/gemma-2-27b-it.
|
|
# ------------------------------------------------------------------------------
|
|
|
|
- name: Write HuggingFace token to ~/.cache/huggingface/token
|
|
ansible.builtin.copy:
|
|
content: "{{ vault_hf_token }}"
|
|
dest: "/home/{{ llm_venv_owner }}/.cache/huggingface/token"
|
|
owner: "{{ llm_venv_owner }}"
|
|
group: "{{ llm_venv_owner }}"
|
|
mode: "0600"
|
|
no_log: true
|
|
|
|
- name: Download Gemma 2 27B model via snapshot_download
|
|
ansible.builtin.command:
|
|
cmd: >
|
|
{{ llm_venv_path }}/bin/python -c "
|
|
from huggingface_hub import snapshot_download
|
|
path = snapshot_download(
|
|
'{{ llm_hf_model }}',
|
|
cache_dir='{{ llm_hf_cache_dir }}',
|
|
)
|
|
print(path)
|
|
"
|
|
creates: "{{ llm_hf_cache_dir }}/models--{{ llm_hf_model | replace('/', '--') }}/snapshots"
|
|
become: true
|
|
become_user: "{{ llm_venv_owner }}"
|
|
environment:
|
|
HF_TOKEN: "{{ vault_hf_token }}"
|
|
HOME: "/home/{{ llm_venv_owner }}"
|
|
register: model_download
|
|
timeout: 3600
|
|
no_log: false
|
|
|
|
- name: Print model download path
|
|
ansible.builtin.debug:
|
|
msg: "Model available at: {{ model_download.stdout | default('already present') }}"
|