Ansible MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MCP_ANSIBLE_ENV_<KEY> | No | Forwarded to process env (e.g., MCP_ANSIBLE_ENV_ANSIBLE_CONFIG) | |
| MCP_ANSIBLE_INVENTORY | No | Path to inventory file or directory | |
| MCP_ANSIBLE_ROLES_PATH | No | Colon-separated roles paths | |
| MCP_ANSIBLE_PROJECT_NAME | No | Label for your project | |
| MCP_ANSIBLE_PROJECT_ROOT | No | Absolute path to your Ansible project root | |
| MCP_ANSIBLE_COLLECTIONS_PATHS | No | Colon-separated collections paths |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| ansible_inventoryB | List Ansible inventory hosts and groups using the ansible-inventory CLI. Args: inventory: Optional inventory path or host list (e.g., 'hosts.ini' or 'localhost,'). include_hostvars: If true, include hostvars keys in the response (not the full values). cwd: Optional working directory to run the command in. Returns: Dict with keys: ok, rc, hosts, groups, hostvars_keys (optional), command, stderr |
| inventory-parseA | Parse inventory via ansible-inventory, merging group_vars/host_vars. Args: project_root: Project root folder (sets CWD and uses ansible.cfg if present) ansible_cfg_path: Explicit ansible.cfg path (overrides) inventory_paths: Optional list of inventory files/dirs (ini/yaml/no-ext supported) include_hostvars: Include merged hostvars in response deep: Placeholder for future source mapping; ignored for now |
| inventory-graphC | Return ansible-inventory --graph output using discovered config. |
| inventory-find-hostC | Find a host, its groups, and merged variables across the resolved inventories. |
| ansible-pingC | Ping hosts using the Ansible ad-hoc ping module. |
| ansible-gather-factsC | Gather facts using the setup module and return parsed per-host facts. |
| validate-yamlB | Validate YAML files; return parse errors with line/column if any. |
| galaxy-installC | Install roles and collections from requirements files under the project root. |
| project-bootstrapC | Bootstrap a project: install galaxy deps and report Ansible environment details. |
| inventory-diffB | Diff two inventories: hosts, groups, and optionally hostvars keys. Returns:
|
| inventory-add-hostA | Add a host to an inventory file under a specified group. Args: host_entry: Host definition (e.g., 'dev-test-az1 ansible_host=10.1.1.5') group_name: Target group name (e.g., 'webservers') inventory_file: Path to the inventory file to modify (INI or YAML format) create_group: If True, create the group if it doesn't exist. If False/None and group missing, return error. project_root: Project root folder ansible_cfg_path: Explicit ansible.cfg path inventory_paths: Inventory paths for validation Returns: Dict with ok, message, and details about the operation |
| ansible-test-idempotenceC | Run a playbook twice and ensure no changes on the second run. Returns recap and pass/fail. |
| galaxy-lockB | Create a simple lock file for installed roles/collections under the project root. |
| vault-encryptD | – |
| vault-decryptD | – |
| vault-viewD | – |
| vault-rekeyD | – |
| register-projectA | Register an existing Ansible project with this MCP server. Args: name: Unique project name. root: Project root directory. inventory: Optional default inventory file or directory path. roles_paths: Optional list to export via ANSIBLE_ROLES_PATH. collections_paths: Optional list to export via ANSIBLE_COLLECTIONS_PATHS. playbooks_path: Optional default path for playbooks (relative to root or absolute). env: Optional extra environment variables to export for this project. make_default: If true, set this project as the default. Returns: Dict: saved config path and project list |
| list-projectsA | List all registered Ansible projects and the default selection. |
| project-playbooksB | Discover playbooks (YAML lists) under the project root or configured playbooks_path. |
| project-run-playbookC | Run a playbook within a registered project, applying its inventory and environment. |
| create-playbookA | Create an Ansible playbook from YAML string or object. Args: playbook: YAML string or Python object representing the playbook. output_path: Optional path to write the playbook file. If not provided, a temp file is created. Returns: A dict with keys: path, bytes_written, preview |
| validate-playbookA | Validate playbook syntax using ansible-playbook --syntax-check. Args: playbook_path: Path to the playbook file. inventory: Optional inventory path or host list. cwd: Optional working directory to run the command in. Returns: A dict with keys: ok (bool), rc, stdout, stderr |
| ansible-playbookB | Run an Ansible playbook. Args: playbook_path: Path to the playbook file. inventory: Optional inventory path or host list. extra_vars: Dict of variables passed via --extra-vars. tags: List of tags to include. skip_tags: List of tags to skip. limit: Host limit pattern. cwd: Working directory for the command. check: If true, run in check mode. diff: If true, show diffs. verbose: Verbosity level (1-4) corresponding to -v, -vv, -vvv, -vvvv. Returns: A dict with keys: ok (bool), rc, stdout, stderr, command |
| ansible-taskC | Run an ad-hoc Ansible task using the ansible CLI. Args: host_pattern: Inventory host pattern to target (e.g., 'all' or 'web') module: Module name (e.g., 'ping', 'shell') args: Module arguments, either dict or string inventory: Inventory path or host list become: Use privilege escalation become_user: Target user when using become check: Check mode diff: Show diffs cwd: Working directory verbose: Verbosity level 1-4 connection: Connection type (e.g., 'local', 'ssh'). Defaults to 'local' when targeting localhost. Returns: A dict with keys: ok (bool), rc, stdout, stderr, command |
| ansible-roleA | Execute an Ansible role by generating a temporary playbook. Args: role_name: Name of the role to execute. hosts: Target hosts pattern. inventory: Inventory path or host list. vars: Extra vars for the role. cwd: Working directory. check: Check mode. diff: Show diffs. verbose: Verbosity level 1-4. Returns: ansible_playbook() result dict |
| create-role-structureA | Generate the standard Ansible role directory structure. Args: base_path: Directory where the role directory will be created. role_name: Name of the role directory. Returns: Dict with keys: created (list[str]), role_path |
| ansible-remote-commandC | Execute arbitrary shell commands on remote hosts with enhanced output parsing. Args: host_pattern: Target hosts pattern command: Shell command to execute project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths become: Use privilege escalation timeout: Command timeout in seconds |
| ansible-fetch-logsB | Fetch and analyze log files from remote hosts. Args: host_pattern: Target hosts pattern log_paths: List of log file paths to fetch project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths lines: Number of lines to fetch (like tail -n) filter_pattern: Regex pattern to filter log lines analyze: Perform log pattern analysis |
| ansible-service-managerC | Manage services with status checking and log correlation. Args: host_pattern: Target hosts pattern service_name: Name of the service action: Action to perform (status, start, stop, restart, reload) project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths check_logs: Fetch recent service logs |
| ansible-diagnose-hostA | Comprehensive health assessment of target hosts. Args: host_pattern: Target hosts pattern project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths checks: List of check categories (system, network, security, performance) baseline_compare: Compare against stored baseline include_recommendations: Include actionable recommendations |
| ansible-capture-baselineB | Capture comprehensive system state baseline for later comparison. Args: host_pattern: Target hosts pattern snapshot_name: Name for this baseline snapshot project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths include: Categories to include (configs, processes, network, performance) |
| ansible-compare-statesB | Compare current system state against a previously captured baseline. Args: host_pattern: Target hosts pattern baseline_snapshot_id: ID of the baseline snapshot to compare against current_snapshot_name: Optional name for the current state snapshot project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths |
| ansible-auto-healB | Intelligent automated problem resolution with safety checks. Args: host_pattern: Target hosts pattern symptoms: List of detected symptoms project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths max_impact: Maximum allowed impact level (low, medium, high) dry_run: Preview actions without executing |
| ansible-network-matrixA | Comprehensive network connectivity matrix between hosts. Args: host_patterns: List of source host patterns target_hosts: List of target hostnames/IPs to test (defaults to same as sources) project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths check_ports: List of ports to check connectivity (default: [22, 80, 443]) |
| ansible-security-auditC | Comprehensive security audit and vulnerability assessment. Args: host_pattern: Target hosts pattern project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths audit_categories: Categories to audit (packages, permissions, network, config) generate_report: Generate detailed security report |
| ansible-health-monitorC | Continuous health monitoring with trend analysis. Args: host_pattern: Target hosts pattern project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths monitoring_duration: Total monitoring duration in seconds metrics_interval: Interval between metric collections in seconds |
| ansible-performance-baselineC | Establish performance baselines and detect regressions. Args: host_pattern: Target hosts pattern project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths benchmark_duration: Duration for benchmark tests in seconds store_baseline: Store baseline for future comparisons |
| ansible-log-hunterC | Advanced log hunting and correlation across multiple sources. Args: host_pattern: Target hosts pattern search_patterns: List of regex patterns to search for log_paths: List of log file paths (defaults to common system logs) project_root: Project root directory ansible_cfg_path: Ansible config file path inventory_paths: Inventory file paths time_range: Time range for logs (e.g., '1h', '24h', '7d') correlation_window: Time window in seconds for event correlation |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/vsl8/ansible-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server