Ansible
The Ansible playbooks and scripts provided help automatically set up the OpenRAG environment on one or more servers.
These scripts are designed for installation on fresh production machines.
Prerequisites
Section titled “Prerequisites”Ensure the hardware hosting OpenRAG meets the recommended specifications.
- Ansible installed on your control machine (automatically installed by
deploy.shif missing) - SSH access to target servers (if deploying remotely)
- Ubuntu 20.04+ or similar Linux distribution on target servers
- For remote deployment:
inventory.ini.examplefile from the OpenRAG repository
Local Deployment (Easiest)
Section titled “Local Deployment (Easiest)”cd ansible/./deploy.sh# Choose option 1: "Deploy to local machine"# Select CPU-only or GPU-enabled deployment when promptedThe local deployment will:
- Prompt you to choose between CPU-only or GPU-enabled deployment
- Handle all necessary configurations and installs automatically
- Start all services
Remote Deployment
Section titled “Remote Deployment”-
Create the inventory file (on the control machine):
Terminal window # Rename the example inventory filecp inventory.ini.example inventory.ini# Edit the inventory filenano inventory.ini -
Configure your servers:
[gpu_servers]gpu-server1 ansible_host=192.168.1.100 ansible_user=ubuntu ansible_ssh_private_key_file=~/.ssh/id_rsagpu-server2 ansible_host=192.168.1.101 ansible_user=ubuntu ansible_ssh_private_key_file=~/.ssh/id_rsa[cpu_servers]cpu-server1 ansible_host=192.168.1.102 ansible_user=ubuntu ansible_ssh_private_key_file=~/.ssh/id_rsa[all:vars]ansible_python_interpreter=/usr/bin/python3 -
Run the deployment:
Terminal window ./deploy.sh# Choose option 2: "Deploy remotely"
Files Overview
Section titled “Files Overview”Playbooks
Section titled “Playbooks”playbook.yml- Main deployment playbook with separate GPU-enabled and CPU-only server configurations
Inventory Files
Section titled “Inventory Files”inventory.ini.example- Example inventory template for remote deploymentinventory.ini- Generated automatically for local deployment or manually created for remote deployment
Configuration
Section titled “Configuration”ansible.cfg- Ansible configuration settings
Scripts
Section titled “Scripts”deploy.sh- Interactive deployment and management
Manual Deployment
Section titled “Manual Deployment”If you prefer to run Ansible commands directly:
Local/Remote Deployment
Section titled “Local/Remote Deployment”# Create inventory firstansible-playbook -i inventory.ini playbook.yml --ask-become-passCheck Status
Section titled “Check Status”ansible all -i inventory.ini -m shell -a "docker ps" --becomeService Management
Section titled “Service Management”The deployment script provides several management options:
Interactive Mode
Section titled “Interactive Mode”./deploy.shCommand Line Mode
Section titled “Command Line Mode”# Deploy locally./deploy.sh deploy-local
# Deploy remotely./deploy.sh deploy-remote
# Check status./deploy.sh status
# Stop services./deploy.sh stop
# Start services./deploy.sh start
# View logs./deploy.sh logs [service_name]
# Update deployment./deploy.sh update
# Complete removal./deploy.sh remove-allWhat Gets Installed
Section titled “What Gets Installed”System Packages
Section titled “System Packages”- Docker CE with Compose plugin
- NVIDIA drivers (if GPU detected and GPU server group is used)
- NVIDIA Container Toolkit (for GPU servers)
- Python 3 with pip and uv package manager
- Essential development tools
OpenRAG Components
Section titled “OpenRAG Components”- Complete OpenRAG codebase from GitHub
- All required Python dependencies installed via
uv - Docker containers for OpenRAG services with appropriate profiles:
- GPU servers: Default profile (includes GPU-accelerated services)
- CPU servers: CPU profile (CPU-only services)
Directory Structure
Section titled “Directory Structure”/home/[user]/openrag/├── data/ # Document storage├── db/ # Database files├── logs/ # Application logs├── .hydra_config/ # Hydra configuration cache├── model_weights/ # Cached model files├── vdb/volumes/ # Vector database volumes├── .env # Environment configuration└── ... # OpenRAG source codeConfiguration
Section titled “Configuration”Environment Variables
Section titled “Environment Variables”The deployment automatically creates a .env file from .env.example or copies a local .env file if present. Key variables to customize:
# LLM ConfigurationBASE_URL=http://your-llm-endpointAPI_KEY=your-api-keyMODEL=your-model-name
# Application SettingsAPP_PORT=8080RETRIEVER_TOP_K=20
# Embedder SettingsEMBEDDER_MODEL_NAME=Qwen/Qwen3-Embedding-0.6BVersion Configuration
Section titled “Version Configuration”The playbook uses these default versions (configurable via inventory variables):
# Docker and NVIDIA versionsdocker_compose_version: "2.21.0"nvidia_driver_version: "535"docker_ce_version: "latest"nvidia_container_toolkit_version: "1.17.8-1"Inventory Variables
Section titled “Inventory Variables”You can set variables in your inventory file:
[gpu_servers:vars]nvidia_driver_version=535project_user=ubuntuproject_path=/home/ubuntu/openrag
[cpu_servers:vars]project_user=ubuntuproject_path=/home/ubuntu/openrag
[all:vars]ansible_python_interpreter=/usr/bin/python3Troubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”-
Docker permission denied
Terminal window # Re-login to apply docker group membershipsudo su - $USER -
NVIDIA driver installation fails
Terminal window # Check GPU compatibilitylspci | grep -i nvidia -
Services not starting
Terminal window # Check logsdocker compose logs
Manual Recovery
Section titled “Manual Recovery”If something goes wrong, you can manually clean up:
# Stop all containersdocker compose down
# Remove containers and imagesdocker system prune -a
# Re-run deployment./deploy.shComplete System Reset
Section titled “Complete System Reset”For a complete removal of all components (Docker, NVIDIA drivers, OpenRAG):
# Use the deployment script's removal option./deploy.sh remove-allWarning: This will remove Docker, NVIDIA drivers, and all related components. Use with caution!
For OpenRAG application issues, refer to the main project documentation.