CLI to generate and run Ansible playbooks from TOML
npm install toml-opsA command-line interface tool for generating and running Ansible playbooks from simplified TOML configuration files.
- Simplifed TOML-based configuration
- Support for multiple hosts with environment-specific settings
- Make the AI agents tool calls powerful
- Automatic Ansible inventory and playbook generation
- Debug mode for verbose output
- Step-based task execution with privilege escalation options
- AI Agent Integration Enables AI systems to execute complex infrastructure operations through simple declarative configurations
Install dependencies:
``bash`
npm install -g toml-ops
toml
name = "llama-server-start"
description = "Start llama-server on multiple hosts with per-host SSH overrides"
debug = truehosts = [
{ addr = "192.168.67.112" },
# { addr = "192.168.67.113", env = { user = "admin", become = false } },
]
[env]
user = "admin"
ssh_key = "~/.ssh/id_rsa"
python = "/usr/bin/python3"
become = false
[[steps]]
name = "Check if llama-server is running"
command = "pgrep -f 'llama-server' || echo 'No processes found'"
become = false
[[steps]]
name = "Start llama-server"
command = "nohup /opt/homebrew/bin/llama-server --host 0.0.0.0 -hf ggml-org/gpt-oss-20b-GGUF --n-cpu-moe 12 -c 32768 --jinja --no-mmap > llama-server.log 2>&1 &"
become = false
[[steps]]
name = "Show running PID"
command = "pgrep -fl 'llama-server' || echo 'No processes found'"
become = false
`Prerequisites
Before using this tool, ensure you have:
$3
`
Generate SSH key if you don't have one
ssh-keygen -t rsa -b 4096 -f ~/.ssh/my_keyCopy public key to target servers
ssh-copy-id -i ~/.ssh/my_key.pub user@example.comdotnetcli
`
$3
`
On Ubuntu/Debian
sudo apt update
sudo apt install ansibleOn macOS
brew install ansibleOn CentOS/RHEL
sudo yum install ansible
`Usage
`Generate Ansible files without running
toml-ops generate runbook.tomlGenerate and immediately run playbook
toml-ops run runbook.toml
toml-ops run runbooks/llama.cpp/start.tomlEnable debug output
toml-ops run runbook.toml --debugSpecify custom output directory
toml-ops run runbook.toml -o ./ansible-files
``This tool dramatically enhances AI agent capabilities by:
- Simplified Interface: AI agents can generate TOML configurations instead of complex Ansible playbooks
- Structured Output: Consistent format that agents can easily parse and generate
- Powerful Execution: Converts simple declarations into robust infrastructure operations
- Safe Abstraction: Agents don't need to understand Ansible internals to perform complex operations