Skip to content

shell

The shell module executes commands on the remote host via SSH.

shell "echo 'hello world'"
shell "curl -sf http://localhost:8080/health" {
retries 5
delay 3
}
ParameterTypeDescription
(positional)stringThe command to execute
retriesintegerNumber of retry attempts on failure
delayintegerSeconds between retries

The shell module always reports Pending — it has no way to know if the command needs to run. Use it for tasks where idempotency is handled by the command itself, or where the command is safe to repeat.

step "Check connectivity" {
shell "ping -c 1 google.com"
}
step "Wait for app" {
shell "curl -sf http://localhost:8080/health" {
retries 10
delay 5
}
}
step "Get hostname" {
shell "hostname" register="node_hostname"
}
step "Log it" {
shell "echo 'Running on ${node_hostname}'"
}

See Loops & Register for more on capturing command output.