@ssh
Connector¶
Connect to hosts over SSH. This is the default connector and all targets default to this meaning you do not need to specify it - ie the following two commands are identical:
pyinfra my-host.net ...
pyinfra @ssh/my-host.net ...
Examples¶
An inventory file (inventory.py
) containing a single SSH target with SSH
forward agent enabled:
hosts = [
("my-host.net", {"ssh_forward_agent": True}),
]
Multiple hosts sharing the same SSH username:
hosts = (
["my-host-1.net", "my-host-2.net"],
{"ssh_user": "ssh-user"},
)
Multiple hosts with different SSH usernames:
hosts = [
("my-host-1.net", {"ssh_user": "ssh-user"}),
("my-host-2.net", {"ssh_user": "other-user"}),
]
Available Data¶
The following keys can be set as host or group data to control how this connector interacts with the target.
Key |
Description |
Type |
Default |
---|---|---|---|
|
SSH hostname |
|
|
|
SSH port |
|
|
|
SSH user |
|
|
|
SSH password |
|
|
|
SSH key filename |
|
|
|
SSH key password |
|
|
|
Whether to use any active SSH agent |
|
|
|
Whether to look for private keys |
|
|
|
Whether to enable SSH forward agent |
|
|
|
SSH config filename |
|
|
|
SSH known_hosts filename |
|
|
|
SSH strict host key checking |
|
|
|
Override keyword arguments passed into Paramiko’s |
|
|
|
Number of tries to connect via ssh |
|
|
|
Lower bound for random delay between retries |
|
|
|
Upper bound for random delay between retries |
|
|