SSH exec task¶
A command can be executed via the Site Controller via the SSH protocol.
Example¶
{
"label": "show running config",
"taskType": "ExtensionTaskSsh",
"options": {
"host": "192.168.100.100",
"port": 22,
"timeout": 1800,
"commandTemplate": "show running config"
}
}
Options¶
host
- The host to ssh toport
- The port to ssh totimeout
- The timeout for executing the commandcommandTemplate
It can be a Nunjucks (a subset of Jinja2) template.See the Context Objects for available objects according to the stage.For
serverRegistered
,serverDecommissioned
,switchRegistered
: TheServer
andNetwork
objects are available. The user can refer to the Server and NetworkDevice objects’ parameters depending on the asset that is being changed. Refer to your environment’s [API documentation].For
serverInstanceGroupCreateDNS
,serverInstanceGroupUpdateDNS
,serverInstanceGroupDeleteDN
,serverInstanceUpdateDNS
,serverInstanceDeleteDNS
: A server DNS record set object similar to this:
"serverInstanceGroupDNSRecordSet": { "zone": { "zoneName": "eveng-qa02.metalcloud.io", "soaEmail": "admin.eveng-qa02.metalcloud.io", "nameServers": [ "ns1.evenq-qa02.metalcloud.io" ], "ttl": 3600, "isDefault": true }, "infrastructureId": 3870, "serverInstanceGroup": { "label": "instance-array-3386" }, "hostname": "lambda", "fqdn": "lambda.eveng-qa02.metalcloud.io", "ips": [ { "status": "allocated", "ip": "10.20.50.36" } ] }
For
serverCreateDNS
,serverDeleteDNS
an object similar to is provided invariables.json
:
"serverDNSRecordSet": { "zone": { "zoneName": "us08.metalsoft.io", "soaEmail": "admin.us08.metalsoft.io", "nameServers": ["n1.metalsoft.io"], "ttl": 3600, "isDefault": true }, "serverId": 10, "serialNumber": "serial-number", "managementAddress": "192.168.100.100", "hostname": "server-10", "fqdn": "server-10.us08.metalsoft.io", "ip": { "status": "allocated", "ip": "192.168.100.100" }, "operation": "create" }
For
switchCreateDNS
,switchDeleteDNS
the following payload is provided:
"switchDNSRecordSet": { "zone": { "zoneName": "us08.metalsoft.io", "soaEmail": "admin.us08.metalsoft.io", "nameServers": ["n1.metalsoft.io"], "ttl": 3600, "isDefault": true }, "switchId": 10, "managementAddress": "192.168.100.100", "hostname": "switch-10", "fqdn": "switch-10.us08.metalsoft.io", "ip": { "status": "allocated", "ip": "192.168.100.100" }, "operation": "create" }