inventory-add-host
Add a host to an Ansible inventory file under a specified group, with option to create the group if missing.
Instructions
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
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"host_entry": "<host_entry>",
"group_name": "<group_name>",
"inventory_file": "<inventory_file>"
},
"name": "inventory-add-host"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_name | Yes | ||
| host_entry | Yes | ||
| create_group | No | ||
| project_root | No | ||
| inventory_file | Yes | ||
| inventory_paths | No | ||
| ansible_cfg_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||