MCP server for Ansible automation
## Ansible MCP Server: Infrastructure Automation The **Ansible MCP Server** integrates Red Hat Ansible automation into Google Antigravity, enabling developers to run playbooks, manage inventories, and automate infrastructure configuration. ### Why Ansible MCP? - **Agentless** - No agents required on managed nodes - **Playbook execution** - Run Ansible playbooks - **Inventory management** - Dynamic inventory support - **Role management** - Use Ansible Galaxy roles - **Vault integration** - Secure secrets management ### Key Features #### 1. Playbook Execution ```python # Run playbook result = await mcp.call("ansible", "run_playbook", { "playbook": "site.yml", "inventory": "production", "extra_vars": { "app_version": "2.0.0" } }) print(f"Status: {result[\"status\"]}") print(f"Changed: {result[\"stats\"][\"changed\"]}") ``` #### 2. Ad-hoc Commands ```python # Run ad-hoc command output = await mcp.call("ansible", "run_command", { "pattern": "webservers", "module": "shell", "args": "uptime" }) for host, result in output.items(): print(f"{host}: {result[\"stdout\"]}") # Ping all hosts ping = await mcp.call("ansible", "ping", { "pattern": "all" }) ``` #### 3. Inventory Management ```python # List inventory inventory = await mcp.call("ansible", "list_inventory", { "inventory": "production" }) for group, hosts in inventory["groups"].items(): print(f"{group}: {hosts}") # Get host variables hostvars = await mcp.call("ansible", "get_hostvars", { "inventory": "production", "host": "web01" }) ``` #### 4. Role Management ```python # Install role from Galaxy await mcp.call("ansible", "install_role", { "name": "geerlingguy.docker", "version": "6.0.0" }) # List installed roles roles = await mcp.call("ansible", "list_roles", {}) for role in roles: print(f"{role[\"name\"]}: {role[\"version\"]}") ``` ### Configuration ```json { "mcpServers": { "ansible": { "command": "npx", "args": ["-y", "@anthropic/mcp-ansible"], "env": { "ANSIBLE_CONFIG": "/path/to/ansible.cfg", "ANSIBLE_VAULT_PASSWORD_FILE": "/path/to/vault_pass" } } } } ``` ### Use Cases **Server Configuration**: Automate server setup. **App Deployment**: Deploy applications. **Infrastructure as Code**: Version-controlled infra. **Compliance**: Enforce configuration standards. The Ansible MCP Server enables infrastructure automation.
{
"mcpServers": {
"ansible": {
"mcpServers": {
"ansible": {
"args": [
"mcp-sysoperator"
],
"command": "uvx"
}
}
}
}
}