SSHCommand
SSHes into provided system, and executes a command.
Added in version 1.0.0.
Friendly name:
Run a command through an SSH tunnelStep class:
base_steps_syncpack.steps.SSHCommand.SSHCommandStep version:
1.0.3Required parameters:
ip,username,cmd
Parameters
Name |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
yes |
– |
The ip address of the IS manager node |
|
string |
yes |
|
Username for manager node |
|
string |
no |
|
password for manager node or paraphrase to decrypt SSH key |
|
string (long) |
no |
– |
Remote SSH Key content as one liner string using the newline char ‘\n’ as separator Example: |
|
boolean |
no |
|
Use SSH Key provided to authenticate to the remote system |
|
string (multi-line) |
yes |
– |
The SSH command to execute |
Every step also accepts the platform parameters common to all steps – see Platform parameters.
Dependencies
Inherits from:
SSHCommand->BaseStep->SerializableSyncPack modules:
base_steps_syncpack.util.ssh_connection_utilsExternal packages:
ipaascommon,ipaascore
Behaviour
Opens an SSH connection through util.ssh_connection_utils (paramiko, with
FIPS-compatible key handling) and runs cmd. Authentication is by key when
use_ssh_key is truthy, otherwise by password.
Outputs
{
"stdout": ["line one", "line two"],
"stderr": []
}
Both are lists of strings, and either can be empty.
Example
{
"ip": "203.0.113.10",
"username": "isadmin",
"cmd": "systemctl is-active iservices_steprunner"
}
Notes
ssh_keytakes the key content as a single line, with literal\nsequences standing in for newlines — not a path to a key file.passworddoes double duty: it is the login password for password auth, and the passphrase for the key whenuse_ssh_keyis set.The command’s exit status is not part of the output. A command that fails but writes to stderr looks the same as one that succeeded quietly — check
stderrdownstream, or make the command itself fail loudly.
API
- class base_steps_syncpack.steps.SSHCommand.SSHCommand
Bases:
BaseStep- run_command(cmd, ssh, hide_logs=False)
Run a remote command on a system and return the stdout stderr
- Parameters:
cmd (str) – command to run
ssh (SSHClient) – ssh client connected to remote system
hide_logs (bool) – True will hide logs
- Returns:
dict