An interactive terminal UI for building ansible-playbook commands. Discovers playbooks, extracts variables from roles, and lets you fill in values — then copies the ready-to-run command to your clipboard.
┌─ Playbooks [*] ─────┬─ Variables (12) | 3 roles ───────────────────────────┐
│ deploy-k3s │ cluster_name k3s-prod Name of ... │
│ setup-monitoring │ > admin_user admin Admin us... │
│ backup-etcd │ node_count 3 Number o... │
│ rotate-certs │ enable_traefik true Enable T... │
│ │ registry_mirror [complex] Container.. │
│ │ vault_password [vault-encrypted] │
│ │ log_level info Logging ... │
├──────────────────────┴──────────────────────────────────────────────────────┤
│ ansible-playbook playbooks/deploy-k3s.yml \ │
│ -e cluster_name=k3s-prod \ │
│ -e admin_user=admin Copied to clipboard! │
└─────────────────────────────────────────────────────────────────────────────┘
- Playbook discovery -- automatically finds all
.yml/.yaml files in your playbooks directory
- Variable extraction -- parses
vars: from playbooks and defaults/main.yml from every referenced role (including include_role/import_role in tasks)
- Deduplication -- merges variables across roles with playbook-level vars taking priority
- Comment-aware -- pulls variable descriptions from YAML comments
- Smart types -- vault-encrypted values, maps, and lists are shown but marked non-editable; simple scalars and empty lists are editable
- Live command preview -- bottom pane updates in real time as you fill in values
- Clipboard copy -- one keypress to copy the command
- Vim navigation --
j/k, / search with n/N, page up/down
- Shell-safe output -- values are properly escaped for direct shell use
- Go 1.21+
- A terminal that supports ANSI colors
go install github.com/ay-b/cli-constructor@latest
Or build from source:
git clone https://github.com/ay-b/cli-constructor.git
cd cli-constructor
go build -o cli-constructor .
Run from a directory that contains playbooks/ and roles/ subdirectories (standard Ansible layout):
your-project/
├── playbooks/
│ ├── deploy-k3s.yml
│ ├── setup-monitoring.yml
│ └── backup-etcd.yml
└── roles/
├── k3s_server/
│ └── defaults/
│ └── main.yml
├── monitoring/
│ └── defaults/
│ └── main.yml
└── etcd/
└── defaults/
└── main.yml
# Default: looks for ./playbooks/ and ./roles/
cli-constructor
# Custom paths
cli-constructor -d /path/to/playbooks -r /path/to/roles
# Long-form flags
cli-constructor --playbooks-dir ../ansible/playbooks --roles-dir ../ansible/roles
| Key |
Action |
Tab |
Cycle panes (playbooks -> variables -> command) |
Ctrl+C |
Quit |
q |
Quit |
? |
Show help overlay |
| Key |
Action |
j / Down |
Next playbook |
k / Up |
Previous playbook |
PgDn / PgUp |
Page down / up |
Enter |
Focus variables pane |
/ |
Search playbooks |
n / N |
Next / previous search match |
| Key |
Action |
j / Down |
Next variable |
k / Up |
Previous variable |
PgDn / PgUp |
Page down / up |
Enter |
Edit selected variable |
d |
Reset variable to default |
/ |
Search variables (name, description, default) |
n / N |
Next / previous search match |
| Key |
Action |
Enter |
Confirm value |
Escape |
Cancel |
| Key |
Action |
Enter / c / C |
Copy command to clipboard |
- Discovery -- scans the playbooks directory for
.yml/.yaml files
- Parsing -- for each playbook, extracts roles from
roles:, include_role, and import_role directives, plus playbook-level vars:
- Role inspection -- reads
defaults/main.yml from each role to collect variables with their defaults and descriptions
- Deduplication -- merges all variables, with playbook-level definitions taking precedence over role defaults
- Interactive editing -- presents everything in a three-pane TUI where you select a playbook, fill in variable values, and see the resulting command update live
- Output -- generates a properly escaped
ansible-playbook command with -e key=value flags for every variable you've set
| Color |
Meaning |
| White |
Variable name (default value not overridden) |
| Yellow |
Variable name with a user-set value |
| Green |
User-entered value |
| Gray |
Default values, descriptions, complex/vault variables |
Complex types (maps, non-empty lists, vault-encrypted values) are displayed for reference but cannot be edited in the TUI.
MIT