YAML Manifests
A manifest is a YAML file that combines data, hierarchy configuration, and resources in a single file.
Manifests support template expressions but not procedural logic. Think of them as declarative configuration similar to multi-resource shell scripts.
CCM Studio
An experimental visual editor for manifests is available at CCM Studio.
Manifest Structure
A manifest contains these top-level sections:
| Section | Description |
|---|---|
data | Input data (like module parameters) |
hierarchy | Lookup order and merge strategy for overrides |
overrides | Data overrides keyed by hierarchy entries |
ccm | Resource definitions and execution options |
Note
A JSON Schema for manifests is available at https://choria-cm.dev/schemas/ccm/v1/manifest.json. Configure your editor to use this schema for completion and validation.
The manifest is resolved using the Choria Hierarchical Data Resolver.
Full Example
Input Data
Define input data like parameters for a module:
Resources
Define resources to manage in the ccm section:
Configure Hierarchy
Configure a hierarchy to vary data by dimensions like OS platform:
This looks for overrides in os:rhel, os:debian, etc.
Overrides
Provide platform-specific data overrides:
Applying Manifests
The complete manifest:
Apply the manifest with ccm apply. The first run makes changes; subsequent runs are stable:
To preview the fully resolved manifest without applying it:
Pre and Post Messages
Display messages before and after manifest execution:
Both are optional.
Overriding Data
Override or augment manifest data with an external Hiera source:
Supported sources include local files, KV stores (kv://), and HTTP(S) URLs.
Setting Defaults
Reduce repetition by setting defaults for resources of the same type:
The first two files inherit the defaults values. The /app/bin/app file overrides just the mode. The /etc/motd file is a separate resource block, so defaults do not apply.
Templating
Manifests support template expressions like {{ lookup("key") }} for adjusting values. These expressions cannot generate new resources; they only modify values in valid YAML.
Available Variables
Templates have access to:
| Variable | Description |
|---|---|
Facts | System facts |
Data | Resolved Hiera data |
Environ | Environment variables |
Generating Resources with Jet Templates
To dynamically generate resources from data, use Jet Templates.
Given this data:
Reference a Jet template file instead of inline resources:
Create the template file:
Note
The template file must be in the same directory as the manifest.
The template receives the fully resolved Hiera data, plus Facts and Environ.
Failure Handling
By default, if a resource fails, the apply continues to the next resource.
Fail on Error
To stop execution on the first failure, set fail_on_error:
The second resource is never executed:
Resource Dependencies
Use the require property to ensure a resource only runs after its dependencies succeed:
If the required resource fails, the dependent resource is skipped.
Dry Run (Noop Mode)
Preview changes without applying them:
Note
Noop mode cannot always detect cascading effects. If one resource change would affect a later resource, that dependency may not be reflected in the dry run.
Health Check Only Mode
Run only health checks without applying resources:
This is useful for verifying system state without making changes.
Manifests in NATS Object Store
Manifests can be stored in NATS Object Stores, avoiding the need to distribute files locally.
Configure a NATS context for authentication:
Create an Object Store:
Create a manifest with supporting files:
Package and upload to the Object Store:
Apply the manifest:
Manifests on Web Servers
Store gzipped tar archives on a web server and apply them directly:
HTTP Basic Auth is supported via URL credentials:
Additional Facts
Provide additional facts from the command line or a file:
Facts from these sources are merged with system facts, with command-line facts taking precedence.