Skip to main content
ansible-cmdb supports multiple output formats to suit different use cases. Select a format using the -t or --template option.

Format Overview

html_fancy

Dynamic, modern HTML page with searchable, sortable host tables

html_fancy_split

Split HTML output with separate files for each host

txt_table

Quick text table summary with minimal host information

json

Complete JSON export of all hosts, groups, and variables

csv

CSV spreadsheet format for host data

markdown

Host information formatted in Markdown

markdown_split

Split Markdown output with separate files for each host

sql

SQL file for importing into SQLite or MySQL databases

html_fancy

Default template. A fancy HTML page that uses jQuery and DataTables to give you a searchable, sortable table overview of all hosts with detailed information just a click away.

Usage

ansible-cmdb -t html_fancy -i hosts out/ > overview.html

Parameters

The html_fancy template accepts optional parameters:
  • local_js=0|1: Load resources from local disk (default=0). If set, will load resources from the local disk instead of over the network.
  • collapsed=0|1: Controls whether host information is collapsed by default or not. A value of 1 will collapse all host information by default (default=0).
  • host_details=0|1: Render host details or not (default=1).
  • skip_empty=0|1: Skip hosts for which no facts were gathered (unreachable, etc) (default=0).

Example with Parameters

ansible-cmdb -t html_fancy -p local_js=1 -p collapsed=1 -i hosts out/ > overview.html

html_fancy_split

This template is basically the same as the html_fancy template, but it generates a cmdb/ directory with an index.html file and a separate html file for each host’s details. This is useful if you have a large amount of hosts and the html_fancy template is rendering too slow.

Usage

ansible-cmdb -t html_fancy_split -i hosts out/
This creates a cmdb/ directory with:
  • index.html - Main overview page
  • [hostname].html - Individual host detail pages

Parameters

Accepts the same parameters as the html_fancy template:
  • local_js=0|1: Load resources from local disk (default=0)
  • collapsed=0|1: Controls whether host information is collapsed by default (default=0)
  • host_details=0|1: Render host details or not (default=1)
  • skip_empty=0|1: Skip hosts for which no facts were gathered (default=0)

txt_table

A quick text table summary of the available hosts with some minimal information. Outputs plain text suitable for terminal display.

Usage

ansible-cmdb -t txt_table -i hosts out/

Column Support

The txt_table template supports custom column selection. See Column Reference for available columns.
ansible-cmdb -t txt_table --columns name,os,ip,mem,cpus facts/

json

Dumps all hosts including groups, variables, and custom info in JSON format. Perfect for programmatic access or integration with other tools.

Usage

ansible-cmdb -t json -i hosts out/ > cmdb.json

Output Structure

The JSON output includes:
  • Complete host facts
  • Group memberships
  • Host variables
  • Custom variables and facts

csv

The CSV template outputs a CSV file of your hosts. Can be imported into spreadsheet applications or other tools.

Usage

ansible-cmdb -t csv -i hosts out/ > hosts.csv

markdown

The Markdown template generates host information in Markdown format, suitable for documentation or wiki pages.

Usage

ansible-cmdb -t markdown -i hosts out/ > hosts.md

markdown_split

Similar to html_fancy_split, this template generates a directory with a main index file and separate Markdown files for each host’s details.

Usage

ansible-cmdb -t markdown_split -i hosts out/
This creates a directory with:
  • index.md - Main overview page
  • [hostname].md - Individual host detail pages

sql

The SQL template generates an .sql file that can be loaded into an SQLite or MySQL database.

Usage

ansible-cmdb -t sql -i hosts out/ > cmdb.sql

Loading into MySQL

# Create database
echo "CREATE DATABASE ansiblecmdb" | mysql

# Import data
mysql ansiblecmdb < cmdb.sql

Loading into SQLite

sqlite3 cmdb.db < cmdb.sql

Selecting a Format

Choose your output format based on your use case:
  • Interactive browsing: Use html_fancy for the best experience
  • Large inventories: Use html_fancy_split or markdown_split for better performance
  • Quick checks: Use txt_table for terminal-friendly output
  • Automation/Integration: Use json for programmatic access
  • Reporting: Use csv for spreadsheet analysis
  • Documentation: Use markdown for wiki or docs
  • Database analysis: Use sql for database querying

Build docs developers (and LLMs) love