inventory-ssh is a lightweight wrapper around the standard ssh client. It reads ansible.cfg and Ansible inventory files from the current directory, resolves the requested host, and then runs SSH with the resolved options. If a host is not found, it can fall back to normal SSH behavior.
- Works as a drop-in wrapper for
ssh - Reads
ansible.cfgand inventory in the current directory - Supports defaults for user, port, and keys
- Optional "inventory only" mode to disable fallback
- Debug logging toggle
- A working
sshclient (OpenSSH recommended) - Ansible inventory files and
ansible.cfgin the directory where you run the tool
See the Releases page on GitHub for prebuilt binaries and packages.
just build
# or
go build .Copy the sample config to your XDG config directory and rename it:
cp config.yml.sample "${XDG_CONFIG_HOME:-$HOME/.config}/inventory-ssh.yml"Key options (see config.yml.sample for the full list):
path: inventory file path (default./hosts)ssh_command: path or name of the ssh binaryinventory_only: iftrue, do not fall back to plain SSHdebug: enable debug logsdefaults: defaultuser,port,private_keys, and passwords
Run it exactly like ssh, but from a directory containing your inventory:
inventory-ssh my-hostOptional: set an alias to transparently use it as ssh:
# $HOME/.bashrc
alias ssh="inventory-ssh"Connect using inventory resolution:
inventory-ssh app-server-1Force inventory-only behavior (set in config):
inventory_only: true- If the host is not found and
inventory_onlyisfalse, inventory-ssh runs the underlyingsshcommand directly. - Ansible is a trademark of Red Hat, Inc. This project is not affiliated with, endorsed by, or sponsored by Red Hat or the Ansible project.
See LICENSE.md.