ssh_add_host
Register a new SSH host to the inventory with alias, hostname, username, and authentication method. Supports key, password, or agent-based logins.
Instructions
Register a new SSH host in the inventory.
Saves the host details to hosts.yaml so it can be referenced by alias in all other ssh_* tools. Supports key, password, and agent authentication.
Args: alias: Short nickname for the host (e.g., 'webserver', 'db-prod'). Only letters, digits, underscores, and hyphens are allowed. hostname: IP address or FQDN (e.g., '192.168.1.10', 'db.example.com'). username: SSH login username (e.g., 'ubuntu', 'ec2-user'). auth_type: Authentication method — 'key' (private key file), 'password', or 'agent' (ssh-agent). port: SSH port (default 22). key_path: Required when auth_type='key'. Path to the private key file (e.g., '~/.ssh/id_rsa'). key_passphrase: Optional passphrase to decrypt an encrypted private key. password: Required when auth_type='password'. description: Optional human-readable note about this server. overwrite: Set True to replace an existing host with the same alias.
Returns: Success message or error description.
Examples: - Add a key-based host: alias='webserver', hostname='10.0.0.5', username='ubuntu', auth_type='key', key_path='~/.ssh/id_rsa' - Add a password host: alias='legacy', hostname='old.corp.net', username='admin', auth_type='password', password='s3cr3t' - Add an agent-auth host: alias='jump', hostname='bastion.example.com', username='ops', auth_type='agent'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alias | Yes | ||
| hostname | Yes | ||
| username | Yes | ||
| auth_type | Yes | ||
| port | No | ||
| key_path | No | ||
| key_passphrase | No | ||
| password | No | ||
| description | No | ||
| overwrite | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |