Cohorts
Cohorts let you organize sprouts into named groups for targeting with cook, cmd run, ssh, and other operations. They replace ad-hoc glob patterns with reusable, manageable groupings.
Cohort Types
Section titled “Cohort Types”Static
Section titled “Static”A fixed list of sprout names:
[cohorts.webservers]type = "static"members = ["web-01", "web-02", "web-03"]Dynamic
Section titled “Dynamic”Membership is determined by matching a sprout property at evaluation time:
[cohorts.linux-hosts]type = "dynamic"match_prop = "os"match_value = "linux"Dynamic cohorts automatically include any sprout whose property matches the condition. Use grlx cohorts refresh to re-evaluate membership against currently connected sprouts.
Compound
Section titled “Compound”Combine other cohorts with boolean logic:
[cohorts.prod-linux]type = "compound"operator = "AND"operands = ["production", "linux-hosts"]Supported operators:
| Operator | Description |
|---|---|
AND | Sprouts that belong to all listed cohorts |
OR | Sprouts that belong to any listed cohort |
EXCEPT | Sprouts in the first cohort but not the rest |
Compound cohorts can reference other compound cohorts (nesting), with a depth limit to prevent cycles.
CLI Commands
Section titled “CLI Commands”List all cohorts
Section titled “List all cohorts”grlx cohorts listShow cohort details
Section titled “Show cohort details”grlx cohorts show webserversDisplays the cohort type, configuration, and resolved member list.
Refresh dynamic membership
Section titled “Refresh dynamic membership”# Refresh a specific cohortgrlx cohorts refresh webservers
# Refresh all cohortsgrlx cohorts refreshRe-evaluates dynamic cohort membership against currently connected sprouts and their properties.
JSON output
Section titled “JSON output”All cohort commands support --out json for machine-readable output:
grlx cohorts list --out jsongrlx cohorts show webservers --out jsonUsing Cohorts
Section titled “Using Cohorts”Cohorts can be used anywhere you target sprouts:
# Cook a recipe against a cohortgrlx cook nginx-setup -C webservers
# Run a command on a cohortgrlx cmd run "uptime" -C linux-hosts
# SSH with cohort pickergrlx ssh -C webserversRBAC Integration
Section titled “RBAC Integration”RBAC permissions are assigned per-cohort. A user might have cook and view permissions on the staging cohort but only view on production. See the RBAC documentation for details.