refactor: consolidate model management into Ansible playbook

Remove flux/musicgen standalone implementations in favor of ComfyUI:
- Delete models/flux/ and models/musicgen/ directories
- Remove redundant scripts (install.sh, download-models.sh, prepare-template.sh)
- Update README.md to reference Ansible playbook commands
- Update playbook.yml to remove flux/musicgen service definitions
- Add COMFYUI_MODELS.md with comprehensive model installation guide
- Update stop-all.sh to only manage orchestrator and vLLM services

All model downloads and dependency management now handled via
Ansible playbook tags (base, python, vllm, comfyui, comfyui-essential).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-22 00:31:26 +01:00
parent 7edf17551a
commit c9b01eef68
12 changed files with 774 additions and 874 deletions

View File

@@ -13,14 +13,21 @@
# ansible-playbook playbook.yml --tags validate # Validate installation
#
# Tags:
# base - System packages and dependencies
# python - Python environment setup
# dependencies- Install Python packages
# models - Download AI models
# comfyui - Install and configure ComfyUI
# tailscale - Install and configure Tailscale
# systemd - Configure systemd services
# validate - Health checks and validation
# base - System packages and dependencies
# python - Python environment setup
# dependencies - Install Python packages
# models - Download AI models (vLLM, Flux, MusicGen)
# comfyui - Install and configure ComfyUI base
# comfyui-models-image - Download ComfyUI image generation models
# comfyui-models-video - Download ComfyUI video generation models
# comfyui-models-audio - Download ComfyUI audio generation models
# comfyui-models-support - Download CLIP, IP-Adapter, ControlNet models
# comfyui-models-all - Download all ComfyUI models
# comfyui-nodes - Install essential custom nodes
# comfyui-essential - Quick setup (ComfyUI + essential models only)
# tailscale - Install and configure Tailscale
# systemd - Configure systemd services
# validate - Health checks and validation
#
- name: Provision RunPod GPU Instance for AI Services
@@ -50,6 +57,208 @@
name: "facebook/musicgen-medium"
size_gb: 11
# ========================================================================
# ComfyUI Models - Comprehensive List for 24GB GPU
# ========================================================================
# ComfyUI Image Generation Models
comfyui_image_models:
# FLUX Models (Black Forest Labs) - State of the art 2025
- name: "black-forest-labs/FLUX.1-schnell"
type: "checkpoint"
category: "image"
size_gb: 23
vram_gb: 23
format: "fp16"
description: "FLUX.1 Schnell - Fast 4-step inference"
essential: true
- name: "black-forest-labs/FLUX.1-dev"
type: "checkpoint"
category: "image"
size_gb: 23
vram_gb: 23
format: "fp16"
description: "FLUX.1 Dev - Balanced quality/speed"
essential: false
# SDXL Models - Industry standard
- name: "stabilityai/stable-diffusion-xl-base-1.0"
type: "checkpoint"
category: "image"
size_gb: 7
vram_gb: 12
format: "fp16"
description: "SDXL 1.0 Base - 1024x1024 native resolution"
essential: true
- name: "stabilityai/stable-diffusion-xl-refiner-1.0"
type: "checkpoint"
category: "image"
size_gb: 6
vram_gb: 12
format: "fp16"
description: "SDXL Refiner - Enhances base output"
essential: false
# SD 3.5 Models - Latest Stability AI
- name: "stabilityai/stable-diffusion-3.5-large"
type: "checkpoint"
category: "image"
size_gb: 18
vram_gb: 20
format: "fp16"
description: "SD 3.5 Large - MMDiT architecture"
essential: false
# ComfyUI Video Generation Models
comfyui_video_models:
# CogVideoX - Text-to-video
- name: "THUDM/CogVideoX-5b"
type: "video"
category: "video"
size_gb: 20
vram_gb: 12 # with optimizations
description: "CogVideoX 5B - Professional text-to-video"
essential: true
# Stable Video Diffusion
- name: "stabilityai/stable-video-diffusion-img2vid"
type: "video"
category: "video"
size_gb: 8
vram_gb: 16
description: "SVD - 14 frame image-to-video"
essential: true
- name: "stabilityai/stable-video-diffusion-img2vid-xt"
type: "video"
category: "video"
size_gb: 8
vram_gb: 20
description: "SVD-XT - 25 frame image-to-video"
essential: false
# ComfyUI Audio Generation Models
comfyui_audio_models:
- name: "facebook/musicgen-small"
type: "audio"
category: "audio"
size_gb: 3
vram_gb: 4
description: "MusicGen Small - Fast music generation"
essential: false
- name: "facebook/musicgen-medium"
type: "audio"
category: "audio"
size_gb: 11
vram_gb: 8
description: "MusicGen Medium - Balanced quality"
essential: true
- name: "facebook/musicgen-large"
type: "audio"
category: "audio"
size_gb: 22
vram_gb: 16
description: "MusicGen Large - Highest quality"
essential: false
# ComfyUI Supporting Models (CLIP, IP-Adapter, ControlNet)
comfyui_support_models:
# CLIP Vision Models
- name: "openai/clip-vit-large-patch14"
type: "clip_vision"
category: "support"
size_gb: 2
description: "CLIP H - For SD 1.5 IP-Adapter"
essential: true
target_dir: "clip_vision"
- name: "laion/CLIP-ViT-bigG-14-laion2B-39B-b160k"
type: "clip_vision"
category: "support"
size_gb: 7
description: "CLIP G - For SDXL IP-Adapter"
essential: true
target_dir: "clip_vision"
- name: "google/siglip-so400m-patch14-384"
type: "clip_vision"
category: "support"
size_gb: 2
description: "SigLIP - For FLUX models"
essential: true
target_dir: "clip_vision"
# ComfyUI Custom Nodes - Essential Extensions
comfyui_custom_nodes:
# ComfyUI Manager - Must have
- name: "ComfyUI-Manager"
repo: "https://github.com/ltdrdata/ComfyUI-Manager.git"
category: "manager"
description: "Install/manage custom nodes and models"
essential: true
# Video Generation Nodes
- name: "ComfyUI-VideoHelperSuite"
repo: "https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git"
category: "video"
description: "Video operations and processing"
essential: true
- name: "ComfyUI-AnimateDiff-Evolved"
repo: "https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved.git"
category: "video"
description: "AnimateDiff for video generation"
essential: true
- name: "ComfyUI-CogVideoXWrapper"
repo: "https://github.com/kijai/ComfyUI-CogVideoXWrapper.git"
category: "video"
description: "CogVideoX integration"
essential: false
# Image Enhancement Nodes
- name: "ComfyUI_IPAdapter_plus"
repo: "https://github.com/cubiq/ComfyUI_IPAdapter_plus.git"
category: "image"
description: "IP-Adapter for style transfer"
essential: true
- name: "ComfyUI-Impact-Pack"
repo: "https://github.com/ltdrdata/ComfyUI-Impact-Pack.git"
category: "image"
description: "Auto face enhancement, detailer"
essential: true
- name: "Comfyui-Inspire-Pack"
repo: "https://github.com/ltdrdata/ComfyUI-Inspire-Pack.git"
category: "image"
description: "Additional inspiration tools"
essential: false
# Audio Generation Nodes
- name: "comfyui-sound-lab"
repo: "https://github.com/eigenpunk/comfyui-sound-lab.git"
category: "audio"
description: "MusicGen and Stable Audio integration"
essential: true
# Utility Nodes
- name: "ComfyUI-Advanced-ControlNet"
repo: "https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet.git"
category: "control"
description: "Advanced ControlNet features"
essential: false
- name: "ComfyUI-3D-Pack"
repo: "https://github.com/MrForExample/ComfyUI-3D-Pack.git"
category: "3d"
description: "3D asset generation"
essential: false
# Service configuration
services:
- name: orchestrator
@@ -58,12 +267,6 @@
- name: vllm
port: 8001
script: models/vllm/server.py
- name: flux
port: 8002
script: models/flux/server.py
- name: musicgen
port: 8003
script: models/musicgen/server.py
- name: comfyui
port: 8188
script: models/comfyui/start.sh
@@ -146,18 +349,6 @@
executable: pip3
become: true
- name: Install Flux dependencies
pip:
requirements: "{{ ai_dir }}/models/flux/requirements.txt"
executable: pip3
become: true
- name: Install MusicGen dependencies
pip:
requirements: "{{ ai_dir }}/models/musicgen/requirements.txt"
executable: pip3
become: true
#
# ComfyUI Installation
#
@@ -195,12 +386,26 @@
state: directory
mode: '0755'
loop:
# Image Model Directories
- checkpoints
- unet
- vae
- loras
- clip
- clip_vision
- controlnet
- ipadapter
- embeddings
- upscale_models
# Video Model Directories
- video_models
- animatediff_models
- animatediff_motion_lora
# Audio Model Directories
- audio_models
# Utility Directories
- configs
- custom_nodes
- name: Create symlink for Flux model in ComfyUI
file:
@@ -231,6 +436,208 @@
Access: http://localhost:8188
#
# ComfyUI Custom Nodes Installation
#
- name: Install ComfyUI Custom Nodes
tags: [comfyui-nodes, comfyui-essential]
block:
- name: Install essential ComfyUI custom nodes
git:
repo: "{{ item.repo }}"
dest: "{{ workspace_dir }}/ComfyUI/custom_nodes/{{ item.name }}"
version: main
update: yes
loop: "{{ comfyui_custom_nodes | selectattr('essential', 'equalto', true) | list }}"
loop_control:
label: "{{ item.name }}"
ignore_errors: yes
- name: Install custom node dependencies
shell: |
if [ -f "{{ workspace_dir }}/ComfyUI/custom_nodes/{{ item.name }}/requirements.txt" ]; then
pip3 install -r "{{ workspace_dir }}/ComfyUI/custom_nodes/{{ item.name }}/requirements.txt"
fi
loop: "{{ comfyui_custom_nodes | selectattr('essential', 'equalto', true) | list }}"
loop_control:
label: "{{ item.name }}"
become: true
ignore_errors: yes
- name: Display custom nodes installation summary
debug:
msg: |
✓ Custom nodes installed successfully!
Essential nodes:
{% for node in comfyui_custom_nodes | selectattr('essential', 'equalto', true) | list %}
- {{ node.name }}: {{ node.description }}
{% endfor %}
To install ALL nodes (including optional):
ansible-playbook playbook.yml --tags comfyui-nodes-all
#
# ComfyUI Image Models Download
#
- name: Download ComfyUI Image Generation Models
tags: [comfyui-models-image, comfyui-models-all, comfyui-essential]
block:
- name: Download essential image generation models
shell: |
python3 -c "
from huggingface_hub import snapshot_download
import os
os.environ['HF_HOME'] = '{{ cache_dir }}'
print('Downloading {{ item.name }}...')
snapshot_download(
repo_id='{{ item.name }}',
cache_dir='{{ cache_dir }}',
token=os.environ.get('HF_TOKEN')
)
print('Completed {{ item.name }}')
"
environment:
HF_TOKEN: "{{ lookup('env', 'HF_TOKEN') }}"
HF_HOME: "{{ cache_dir }}"
loop: "{{ comfyui_image_models | selectattr('essential', 'equalto', true) | list }}"
loop_control:
label: "{{ item.name }} ({{ item.size_gb }}GB)"
async: 3600
poll: 30
ignore_errors: yes
- name: Display image models summary
debug:
msg: |
Image generation models downloaded:
{% for model in comfyui_image_models | selectattr('essential', 'equalto', true) | list %}
- {{ model.name }}: {{ model.description }} ({{ model.size_gb }}GB, {{ model.vram_gb }}GB VRAM)
{% endfor %}
Total size: ~{{ (comfyui_image_models | selectattr('essential', 'equalto', true) | list | sum(attribute='size_gb')) }}GB
#
# ComfyUI Video Models Download
#
- name: Download ComfyUI Video Generation Models
tags: [comfyui-models-video, comfyui-models-all]
block:
- name: Download essential video generation models
shell: |
python3 -c "
from huggingface_hub import snapshot_download
import os
os.environ['HF_HOME'] = '{{ cache_dir }}'
print('Downloading {{ item.name }}...')
snapshot_download(
repo_id='{{ item.name }}',
cache_dir='{{ cache_dir }}',
token=os.environ.get('HF_TOKEN')
)
print('Completed {{ item.name }}')
"
environment:
HF_TOKEN: "{{ lookup('env', 'HF_TOKEN') }}"
HF_HOME: "{{ cache_dir }}"
loop: "{{ comfyui_video_models | selectattr('essential', 'equalto', true) | list }}"
loop_control:
label: "{{ item.name }} ({{ item.size_gb }}GB)"
async: 3600
poll: 30
ignore_errors: yes
- name: Display video models summary
debug:
msg: |
Video generation models downloaded:
{% for model in comfyui_video_models | selectattr('essential', 'equalto', true) | list %}
- {{ model.name }}: {{ model.description }} ({{ model.size_gb }}GB, {{ model.vram_gb }}GB VRAM)
{% endfor %}
#
# ComfyUI Audio Models Download
#
- name: Download ComfyUI Audio Generation Models
tags: [comfyui-models-audio, comfyui-models-all]
block:
- name: Download essential audio generation models
shell: |
python3 -c "
from huggingface_hub import snapshot_download
import os
os.environ['HF_HOME'] = '{{ cache_dir }}'
print('Downloading {{ item.name }}...')
snapshot_download(
repo_id='{{ item.name }}',
cache_dir='{{ cache_dir }}',
token=os.environ.get('HF_TOKEN')
)
print('Completed {{ item.name }}')
"
environment:
HF_TOKEN: "{{ lookup('env', 'HF_TOKEN') }}"
HF_HOME: "{{ cache_dir }}"
loop: "{{ comfyui_audio_models | selectattr('essential', 'equalto', true) | list }}"
loop_control:
label: "{{ item.name }} ({{ item.size_gb }}GB)"
async: 3600
poll: 30
ignore_errors: yes
- name: Display audio models summary
debug:
msg: |
Audio generation models downloaded:
{% for model in comfyui_audio_models | selectattr('essential', 'equalto', true) | list %}
- {{ model.name }}: {{ model.description }} ({{ model.size_gb }}GB)
{% endfor %}
#
# ComfyUI Support Models Download (CLIP, IP-Adapter, ControlNet)
#
- name: Download ComfyUI Support Models
tags: [comfyui-models-support, comfyui-models-all, comfyui-essential]
block:
- name: Download essential support models (CLIP, IP-Adapter)
shell: |
python3 -c "
from huggingface_hub import snapshot_download
import os
os.environ['HF_HOME'] = '{{ cache_dir }}'
print('Downloading {{ item.name }}...')
snapshot_download(
repo_id='{{ item.name }}',
cache_dir='{{ cache_dir }}',
token=os.environ.get('HF_TOKEN')
)
print('Completed {{ item.name }}')
"
environment:
HF_TOKEN: "{{ lookup('env', 'HF_TOKEN') }}"
HF_HOME: "{{ cache_dir }}"
loop: "{{ comfyui_support_models | selectattr('essential', 'equalto', true) | list }}"
loop_control:
label: "{{ item.name }} ({{ item.size_gb }}GB)"
async: 1800
poll: 30
ignore_errors: yes
- name: Display support models summary
debug:
msg: |
Support models downloaded:
{% for model in comfyui_support_models | selectattr('essential', 'equalto', true) | list %}
- {{ model.name }}: {{ model.description }} ({{ model.size_gb }}GB)
{% endfor %}
Total ComfyUI models cache: ~{{
(comfyui_image_models | selectattr('essential', 'equalto', true) | list | sum(attribute='size_gb')) +
(comfyui_video_models | selectattr('essential', 'equalto', true) | list | sum(attribute='size_gb')) +
(comfyui_audio_models | selectattr('essential', 'equalto', true) | list | sum(attribute='size_gb')) +
(comfyui_support_models | selectattr('essential', 'equalto', true) | list | sum(attribute='size_gb'))
}}GB
#
# Download AI Models
#