Skip to main content

What You’ll Accomplish

Runbooks let you create reusable templates for common operations. Instead of typing the same queries or commands repeatedly, you can:
  • Create parameterized templates stored in Git
  • Share approved procedures across your team
  • Enforce input validation and safe defaults
  • Maintain an audit trail of every execution

How It Works

1

Create Template

Write a runbook template with placeholders for parameters
2

Store in Git

Commit the template to your Git repository
3

Configure Hoop

Point Hoop to your repository
4

Execute

Users select the runbook, fill in parameters, and run

Example Workflow

  1. DBA creates a runbook for looking up customer data
  2. Template stored in runbooks/customer-lookup.runbook.sql
  3. Support team selects the runbook, enters customer ID
  4. Query executes with proper validation and audit logging

Quick Start

Prerequisites

To get the most out of this guide, you will need to:
  • A Git repository for storing runbooks
  • Git access credentials (SSH key or token)

Step 1: Create a Runbook File

Create a file in your repository with the .runbook.<ext> extension: runbooks/customer-lookup.runbook.sql

Step 2: Configure Git Integration

In the Web App:
  1. Go to Manage > Runbooks
  2. Click Configure Repository
  3. Enter your repository URL and credentials
Or via CLI:

Step 3: Run the Runbook

  1. Go to Runbooks in the sidebar
  2. Select customer-lookup
  3. Enter the customer ID
  4. Click Execute

Template Syntax

Runbooks use Go’s text/template syntax. Parameters are defined with {{ .parameter_name }}.

Basic Parameter

Parameter with Validation

Parameter Functions

Input Types


Example Runbooks

SQL: Customer Lookup

SQL: Update Order Status

Bash: Service Restart

Python: Data Export

Kubernetes: Scale Deployment


Security Features

Input Validation

Use pattern to prevent injection attacks:

Environment Variables

Use asenv to pass values as environment variables instead of inline:

Quoting

Use squote or dquote to properly quote string values:

File Organization

Recommended repository structure:

Naming Convention

Files must end with .runbook.<extension>:
  • .runbook.sql - SQL queries
  • .runbook.sh - Bash scripts
  • .runbook.py - Python scripts
  • .runbook.rb - Ruby scripts

Integration with Other Features


Troubleshooting

Runbook Not Appearing

Check:
  1. File ends with .runbook.<ext>
  2. Git repository is configured correctly
  3. Hoop can access the repository (check credentials)
  4. Run hoop admin get runbooks to verify sync

Template Parsing Error

Check:
  1. All {{ }} brackets are balanced
  2. Function names are spelled correctly
  3. Pipes | are used correctly
Test locally:

Parameter Validation Failing

If a parameter fails validation:
  1. Check the pattern regex is correct
  2. Test the regex at regex101.com
  3. Ensure required values are provided

Best Practices

Validate Inputs

Always use pattern for user inputs to prevent injection

Add Descriptions

Every parameter should have a clear description

Set Defaults

Provide sensible defaults where appropriate

Version Control

Store runbooks in Git for history and review

Next Steps

Configuration Guide

Detailed Git setup and template syntax

Parallel Mode

Run runbooks across multiple connections

Access Requests

Require approval for runbook execution

Session Recording

Audit runbook executions