diff --git a/playbooks/irv-ml1-r15-r16-nosudo.yaml b/playbooks/irv-ml1-r15-r16-nosudo.yaml new file mode 100644 index 0000000..d0e47cf --- /dev/null +++ b/playbooks/irv-ml1-r15-r16-nosudo.yaml @@ -0,0 +1,48 @@ +# R15 + R16 box stand-up on irv-ml1 — NO-SUDO phase. +# +# Provisions everything that does NOT need root: uv, the R16 `world` venv + +# pyworld, and the engine-root dir skeleton. Two things are deliberately +# OUT of this playbook because they need sudo (separate operator-run phase): +# - R + soundgen (apt install r-base libfftw3-dev libsndfile1-dev; CRAN build) +# - Ollama A6000 GPU pin (systemd drop-in CUDA_VISIBLE_DEVICES=1 + restart) +# The ollama model pulls are also run separately (long-running; ollama pull is +# itself idempotent). +# +# Setup contracts (brokkr-smithy @ irv-ml1:~/r14/brokkr-smithy, pulled to main): +# R15 src/probes/P01/box_models.py — ollama models @ $R15_OLLAMA_HOST (:11434) +# R16 src/probes/P01/box_engines.py — R16_ENGINE_ROOT default ~/r16/engines; +# world venv at $ROOT/world/.venv (pyworld); soundgen runner at $ROOT/soundgen +# +# Rerunnable: a second run should report mostly ok/skipped. + +vars: + engine_root: /home/lkraven/r16/engines + uv_bin: /home/lkraven/.local/bin/uv + +steps: + - name: Install uv (user-local, no sudo) + shell: curl -LsSf https://astral.sh/uv/install.sh | sh + creates: "{{ uv_bin }}" + + - name: Create R16 engine-root dirs (soundgen + world) + shell: mkdir -p {{ engine_root }}/soundgen {{ engine_root }}/world + creates: "{{ engine_root }}/world" + + - name: Create the R16 world venv (python3.11) + shell: "{{ uv_bin }} venv {{ engine_root }}/world/.venv --python 3.11" + creates: "{{ engine_root }}/world/.venv/bin/python" + + - name: Install pyworld (+ setuptools<81 — pyworld imports pkg_resources, removed in setuptools 81) + shell: "{{ uv_bin }} pip install --python {{ engine_root }}/world/.venv/bin/python pyworld 'setuptools<81'" + when: "! {{ engine_root }}/world/.venv/bin/python -c 'import pyworld' 2>/dev/null" + +verify: + - name: uv present + shell: test -x {{ uv_bin }} + changed_when: "false" + - name: world venv python present + shell: test -x {{ engine_root }}/world/.venv/bin/python + changed_when: "false" + - name: pyworld importable in the world venv + shell: "{{ engine_root }}/world/.venv/bin/python -c 'import pyworld; print(\"pyworld\", getattr(pyworld, \"__version__\", \"ok\"))'" + changed_when: "false" diff --git a/playbooks/irv-ml1-r15-r16-sudo.yaml b/playbooks/irv-ml1-r15-r16-sudo.yaml new file mode 100644 index 0000000..ca84a00 --- /dev/null +++ b/playbooks/irv-ml1-r15-r16-sudo.yaml @@ -0,0 +1,57 @@ +# R15 + R16 box stand-up on irv-ml1 — SUDO phase (run AS infra-ops). +# +# scripts/elway infra-ops@10.100.79.3 --playbook playbooks/irv-ml1-r15-r16-sudo.yaml +# +# infra-ops has NOPASSWD sudo (see playbooks/bootstrap-infra-ops-user.yaml), so +# this runs unattended — no operator password prompt. +# +# Does two things: +# 1. R16 soundgen engine: install R + the system libs soundgen's CRAN deps +# need (fftw/sndfile + the usual R-build trio). The soundgen package itself +# compiles separately (slow) — kicked outside this playbook. +# 2. R15 GPU placement: pin the Ollama service to the A6000 so inference lands +# in the A6000's free headroom. yt-voice-clipper + R14 keep running on the +# same card — we share the ~31.5 GB free, we do NOT free the card. +# +# A6000 pinned BY UUID, not index. CUDA's default ordering (FASTEST_FIRST) does +# not match nvidia-smi's PCI order on this box (R14 sees the A6000 as cuda:0 +# while nvidia-smi lists it as index 1), so an index pin is ambiguous and could +# select the 3090. The UUID is unambiguous. + +vars: + a6000_uuid: "GPU-9672f0d5-3caf-b15c-898a-cd9d653c654b" + +steps: + - name: apt update + sudo: true + shell: apt-get update -qq + + - name: Install R + soundgen system deps (fftw/sndfile + R-build libs) + sudo: true + shell: > + DEBIAN_FRONTEND=noninteractive apt-get install -y + r-base libfftw3-dev libsndfile1-dev + libcurl4-openssl-dev libssl-dev libxml2-dev + when: "! command -v Rscript >/dev/null 2>&1" + + - name: Pin the Ollama service to the A6000 (UUID) via systemd drop-in + sudo: true + shell: | + install -d -m 755 /etc/systemd/system/ollama.service.d + printf '[Service]\nEnvironment=CUDA_VISIBLE_DEVICES=%s\n' '{{ a6000_uuid }}' \ + > /etc/systemd/system/ollama.service.d/gpu-pin.conf + systemctl daemon-reload + systemctl restart ollama + when: "! systemctl show ollama -p Environment 2>/dev/null | grep -q '{{ a6000_uuid }}'" + +verify: + - name: Rscript present + shell: command -v Rscript + changed_when: "false" + - name: Ollama service carries the A6000 UUID pin + sudo: true + shell: systemctl show ollama -p Environment | grep -q '{{ a6000_uuid }}' + changed_when: "false" + - name: Ollama API healthy on :11434 after restart + shell: curl -sf http://localhost:11434/api/tags >/dev/null && echo ok + changed_when: "false"