Custom columns allow you to display additional host information in the overview table by extracting data from Ansible facts using jsonxs expressions or Mako templates.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fboender/ansible-cmdb/llms.txt
Use this file to discover all available pages before exploring further.
Custom columns are currently only supported by the
html_fancy and html_fancy_split templates.Overview
The-C (--cust-cols) option takes a path to a Python file containing custom column definitions. Each column can use either:
- jsonxs expressions: Simple path-based fact lookups
- Mako templates: Advanced rendering with full Python logic
Column Definition Structure
Custom column files use Python syntax with a list of dictionaries:Required Fields
| Field | Description | Values |
|---|---|---|
title | User-friendly column header | Any string |
id | Unique column identifier | Lowercase, underscores |
sType | How values are sorted | "string" or "num" |
visible | Show by default | True or False |
Content Fields (one required)
| Field | Description |
|---|---|
jsonxs | Path to fact value (e.g., ansible_facts.ansible_apparmor.status) |
tpl | Mako template fragment with access to host variable |
Using jsonxs Expressions
jsonxs provides simple dot-notation access to nested fact data:Finding jsonxs Paths
Using Mako Templates
Mako templates provide full Python logic for complex rendering:Template Variables
| Variable | Description |
|---|---|
host | Complete host dictionary with all facts |
jsonxs | Function for safe fact access |
Safe Data Access
Complete Example
Here’s a real example from the ansible-cmdb repository:example/cust_cols.conf
Advanced: Sortable Columns
Numeric Sorting
String Sorting with Hidden Values
For human-friendly display with proper sorting, use hidden sort helpers:String sorting considers “100” smaller than “20” since “1” < “2”. Use zero-padding or map values to a 0.0-1.0 range for correct sorting.
Usage
Apply your custom columns file:Troubleshooting: New columns don't appear
Troubleshooting: New columns don't appear
If new columns don’t show up or you experience strange behavior:
- Open the generated HTML in your browser
- Click the Clear settings button in the top-right
- Refresh the page
See Also
- Template Parameters - Configure template behavior
- Custom Templates - Build entirely custom output formats
- jsonxs documentation - Learn more about jsonxs expressions