CCM is designed as a CLI-first tool. Each resource type has its own subcommand under ccm ensure, with required inputs as arguments and optional settings as flags.
The ccm ensure commands are idempotent, making them safe to run multiple times in shell scripts.
Use ccm --help and ccm <command> --help to explore available commands and options.
Managing a Single Resource
Managing a single resource is straightforward.
ccm ensure package zsh 5.8
This ensures the package zsh is installed at version 5.8.
To view the current state of a resource:
ccm status package zsh
Managing Multiple Resources
When managing multiple resources in a script, create a session first. The session records the outcome of each resource, enabling features like refreshing a service when a file changes.
CCM gathers system facts that can be used in templates and conditions:
# Show all facts as JSON
$ ccm facts
# Show facts as YAML
$ ccm facts --yaml
# Query specific facts using gjson syntax
$ ccm facts host.info.platformFamily
Resolving Hiera Data
The ccm hiera command helps debug and test Hiera data resolution:
# Resolve a Hiera file with system facts
$ ccm hiera parse data.yaml -S
# Resolve with custom facts
$ ccm hiera parse data.yaml os=linux env=production
# Query a specific key from the result
$ ccm hiera parse data.yaml --query packages
Subsections of Shell Usage
JSON API
CCM provides a STDIN/STDOUT API for managing resources programmatically. This enables integration with external languages, allowing you to build DSLs in Ruby, Perl, Python, or any language that can execute processes and handle JSON or YAML.
Overview
The API uses a simple request/response pattern:
Send a request to ccm ensure api pipe via STDIN
Receive a response on STDOUT
Both JSON and YAML formats are supported for requests. The response format is always JSON, but can be explicitly set to YAML using --yaml.
Command
ccm ensure api pipe [--yaml] [--noop] [--facts <file>] [--data <file>]
Flag
Description
--yaml
Output response in YAML format instead of JSON
--noop
Dry-run mode; report what would change without making changes
--facts <file>
Load additional facts from a YAML file
--data <file>
Load Hiera-style data from a YAML file
Request Format
Requests must include a protocol identifier, resource type, and properties.
For detailed information about each resource type and its properties, see the Resource Documentation
CLI Plugins
CCM supports extending the CLI with custom commands using App Builder. This allows you to create organization-specific workflows that integrate with the ccm command.
Plugin Locations
CCM searches for plugins in two directories:
Location
Purpose
/etc/choria/ccm/plugins/
System-wide plugins
$XDG_CONFIG_HOME/choria/ccm/plugins/
User plugins (typically ~/.config/choria/ccm/plugins/)
Plugins in the user directory override system plugins with the same name.
Plugin File Format
Plugin files must be named <command>-plugin.yaml. The filename determines the command name:
For complete App Builder documentation including all command types, templating features, and advanced options, see the App Builder documentation.
Since version 0.13.0 of App Builder it has a transform and a command that can invoke CCM Manifests, this combines well with flags, arguments and form wizards to create custom UI’s that manage your infrastructure.