Add tracked systemd unit template for llama-server — previously only existed as commands run live on BigBoy

This commit is contained in:
John A. Hoeven 2026-07-19 22:33:47 +02:00
commit 647834e63e
Signed by: giovannino
GPG key ID: 306E507219506D4E

View file

@ -0,0 +1,54 @@
# llama-server.service — systemd unit for BigBoy's llama.cpp inference server
#
# This is a Jinja2 template (Ansible's `template` module convention),
# ready to use once Phase 5 is formalized into an actual Ansible role.
# Until then, it's the tracked, reproducible reference for what's
# actually configured live on BigBoy — previously this only existed as
# commands typed directly during the deployment session, not committed
# anywhere.
#
# Variables reference group_vars/bigboy.yml where they already exist
# (llama_server_host, llama_server_port, model_repo, model_quant,
# bigboy_admin_user). One deliberate exception: the API key is NOT
# templated from group_vars — see the note below.
#
# Manual deployment (until this is wired into a real Ansible role):
# 1. Fill in the Jinja2 variables below with their actual values
# (or render this file with `ansible-playbook --check` / a
# one-off `ansible.builtin.template` task pointed at this file)
# 2. Copy the rendered result to /etc/systemd/system/llama-server.service
# 3. sudo systemctl daemon-reload
# 4. sudo systemctl enable --now llama-server
[Unit]
Description=llama.cpp server ({{ model_repo }}, {{ model_quant }})
After=network.target
[Service]
Type=simple
User={{ bigboy_admin_user }}
# API key: deliberately NOT a group_vars variable. This template is
# committed to a public repo — hardcoding even a placeholder that might
# later get filled with a real key and accidentally committed is a real
# leak risk. Supply this via ansible-vault, an environment file loaded
# with EnvironmentFile= below, or a gitignored file following the same
# pattern as ansible/keys/workbench.pub — never a plain variable here.
#
# Example using an EnvironmentFile (uncomment and adjust once the key
# file exists, e.g. /etc/llama-server/api-key.env containing
# LLAMA_API_KEY=<the real key>, mode 0600, owned by root):
# EnvironmentFile=/etc/llama-server/api-key.env
ExecStart=/home/{{ bigboy_admin_user }}/llama.cpp/build/bin/llama-server \
-hf {{ model_repo }}:{{ model_quant }} \
-ngl 99 --jinja \
--host {{ llama_server_host }} --port {{ llama_server_port }} \
--cont-batching --parallel 4 \
--api-key ${LLAMA_API_KEY}
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target