SSHCommand

SSHes into provided system, and executes a command.

Added in version 1.0.0.

  • Friendly name: Run a command through an SSH tunnel

  • Step class: base_steps_syncpack.steps.SSHCommand.SSHCommand

  • Step version: 1.0.3

  • Required parameters: ip, username, cmd

Parameters

Name

Type

Required

Default

Description

ip

string

yes

–

The ip address of the IS manager node

username

string

yes

isadmin

Username for manager node

password

string

no

isadmin

password for manager node or paraphrase to decrypt SSH key

ssh_key

string (long)

no

–

Remote SSH Key content as one liner string using the newline char ‘\n’ as separator Example: SSHKey

use_ssh_key

boolean

no

False

Use SSH Key provided to authenticate to the remote system

cmd

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 -> Serializable

  • SyncPack modules: base_steps_syncpack.util.ssh_connection_utils

  • External 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_key takes the key content as a single line, with literal \n sequences standing in for newlines — not a path to a key file.

  • password does double duty: it is the login password for password auth, and the passphrase for the key when use_ssh_key is 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 stderr downstream, 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