back

shell

Run commands and shell snippets on the remote hosts

Overview

  • Run executables on the remote hosts

  • Run shell scripts on the remote hosts

Form

(shell options)

Arguments

options

A hashmap of options. All available keys and their values are described below

Options

OptionDescription
:cmd
required true
type string

    The command or shell snippet to run

:shell
type string

    Specify the shell to use to run the command. Default is bash.

:stdin
required true
type string

    Supply a string argument to pass to the executing script as its standard input

:dir
type string

    Execute the command from within the specified directory.

    Path can be relative or absolute.

    Relative paths are specified in relation to the users home directory.

    Default :dir is "." (users home directory).

:out
type string

    Specify the encoding of the commands output.

    Default is "UTF-8".

:env
type hashmap

    Specify a hashmap of environment variables to set before executing the command.

    Environment variable names can be specified as keywords or strings.

:creates
type vectorlistlazy-seq

    Specify a list of files that the command will create.

    If these files exist on the remote host, the command will not be executed and the job execution will be marked as :ok.

:ok-exit
required true
type functionset

    a callable that will be passed the shell exit code.

    If it returns true, the job is marked as :result :ok

:changed-exit
required true
type functionset

    a callable that will be passed the shell exit code.

    If it returns true the job is marked as :result :changed.

    Note: :changed-exit is checked after :ok-exit. If both return false, the job is marked as :result :failed.

Examples