Overview
Ralph provides a hierarchical configuration system that can be mapped to your configuration management tool’s structure:- Configuration Modules - Top-level groupings (e.g., Puppet modules or Ansible roles)
- Configuration Classes - Specific configurations to apply (e.g., Puppet classes or Ansible playbooks)
- Configuration Path - Per-host configuration assignment
- Configuration Variables - Custom fields exposed as variables
Configuration Modules
Configuration modules represent the top-level organization of your configurations.Creating Configuration Modules
- Navigate to
https://<YOUR-RALPH-URL>/assets/configurationmodule/ - Click “Add configuration module”
- Fill in the details:
- Name - Module name (e.g.,
apache,mysql,monitoring) - Parent - Optional parent module for hierarchical organization
- Support team - Team responsible for this module
- Name - Module name (e.g.,
Hierarchical Structure
You can organize modules in a tree structure to reflect your directory layout:Configuration Classes
Configuration classes define specific configurations to be applied to hosts.Creating Configuration Classes
- Navigate to
https://<YOUR-RALPH-URL>/assets/configurationclass/ - Click “Add configuration class”
- Configure:
- Module - Parent configuration module
- Class name - Specific configuration name
- Path - Full path (auto-generated from module hierarchy)
Assigning Configuration to Hosts
Assign configuration to assets using theconfiguration_path field:
- Edit a Data Center Asset, Virtual Server, or Cloud Host
- Set the Configuration Path field
- Save the asset
Via API
Assign configuration when creating or updating an asset:Puppet Integration
Architecture
Ralph serves as the External Node Classifier (ENC) for Puppet:- Puppet agent requests configuration for a host
- Puppet master queries Ralph API for host details
- Ralph returns configuration path and variables
- Puppet master applies the appropriate classes
Fetching Configuration from Ralph
Create a Puppet ENC script (/etc/puppetlabs/puppet/ralph_enc.py):
Configure Puppet Master
Edit/etc/puppetlabs/puppet/puppet.conf:
Example Puppet Output
When Puppet queries Ralph forweb01.example.com, the ENC script returns:
Ansible Integration
Dynamic Inventory Script
Create an Ansible dynamic inventory script (inventory/ralph.py):
Using the Dynamic Inventory
Test the inventory:Configure ansible.cfg
Example Playbook
Configuration Variables
Ralph allows you to define custom fields that are exposed as configuration variables via the API.Creating Configuration Variables
- Navigate to Admin → Custom Fields
- Create a new custom field
- Check “Use as configuration variable”
- Apply to relevant model (Data Center Asset, Virtual Server, etc.)
Accessing Variables
Configuration variables are available in the API response underconfiguration_variables:
Best Practices
Naming Conventions
- Use clear, descriptive names for modules and classes
- Follow your organization’s naming standards
- Use hierarchical paths that reflect your infrastructure
Security
Error Handling
- Implement retry logic for API calls
- Log all API errors for troubleshooting
- Provide fallback configurations if Ralph is unavailable
- Monitor API response times
Caching
Consider caching Ralph API responses to reduce load:Testing
Always test configuration changes:Troubleshooting
API Connection Issues
Missing Configuration Path
If assets don’t have a configuration path:- Check that configuration modules and classes are created
- Verify the asset has a configuration path assigned
- Ensure your API query is correct
- Check API permissions for the user/token
Puppet ENC Debugging
Ansible Inventory Debugging
Related Documentation
- REST API - Complete API reference
- Custom Fields - Creating configuration variables
- DCIM - Data center asset management