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:
Basic Plugin Structure
Plugins use App Builder’s YAML definition format. Here’s a minimal example:
This creates ccm deploy web which applies a manifest.
Passing Data to Manifests
Plugins can pass data to manifests through environment variables or facts. Both are accessible in manifest templates.
Using Environment Variables
Environment variables set in the plugin are available in manifests via {{ lookup("env.VAR_NAME") }}:
In the manifest:
Using Facts
Pass additional facts using the --fact flag. Facts are available via {{ lookup("facts.KEY") }}:
In the manifest:
Further Reading
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.