C.75 SshTask

The SshTask executes commands on a remote host using ssh. This task requires the PHP SSH2 extension to function.

Table C.100: Attributes

NameTypeDescriptionDefaultRequired
hostStringRemote hostnoneYes
portIntegerRemote port22No
usernameStringUsername to use for the connectionnoneYes
passwordStringPassword to use for the connectionnoneNo
pubkeyfileStringPublic key file (OpenSSH format) to use for the connectionnoneNo
privkeyfileStringPrivate key file (OpenSSH format) to use for the connectionnoneNo
privkeyfilepassphraseStringPrivate key file passphrase to use for the connectionnoneNo
commandStringCommand to execute on the remote servernoneYes
propertyStringThe name of the property to capture (any) output of the commandnoneNo
displayBooleanWhether to display the output of the commandtrueNo
ptyStringThe terminal type to opennoneNo
failonerrorBooleanDecides if a command chain will fail if one of the executed commands failed. Added for backward compatibility. Set to true if you execute more than one command and want the task to fail on any error.FalseNo

C.75.1 Example

<ssh username="john" password="smith"
host="webserver" command="ls" />

Executes a single command on the remote server.

C.75.2 Supported Nested Tags

  • sshconfig

    Sometimes it is necessary to set specific configuration parameters on the ssh connection when connecting to a remote server. You can set them with the sshconfig nested tag. Set the parameters to specify connection and encryption options. These are the parameters as specified by the $methods parameter of the ssh2_connect function. See ssh2_connect for more information

    sshconfig can also be used as project level parameter with a refid so the same parameters can be re-used across a project easily.

    Table C.101: Attributes

    NameTypeDescriptionDefaultRequired
    kexStringList of key exchange methods to advertise, comma separated in order of preference.n/aNo
    hostkeyStringList of hostkey methods to advertise, come separated in order of preference.n/aNo
    clientNested TagElement containing attributes crypt, comp, and mac method preferences for messages sent from client to server. All attributes are optional.n/aNo
    serverNested TagElement containing attributes crypt, comp, and mac method preferences for messages sent from server to client. All attributes are optional.n/aNo