Single and multi target actions

You can use single target or multi target actions to execute script actions.

Single Target

The parameter with the name target has special meaning to script actions as it defines the system on which the action will run. The system can be defined by a short hostname, a FQDN, or an IP address. When executed a script action will connect to the system identified by the target and execute the script there.

The execution result of the script will be reflected in the status of the action. Possible action states are executing, successful, unsuccessful, failed, and unknown. In the case of a fully automated runbook execution, this status will also be used to decide whether the runbook will be canceled or continued.

Examples:

  • An action which receives prod-server1, as the content of the target variable will execute this action on the system prod-server1. The script exited with return code of zero and the state of the action instance is set to successful.

  • An action which receives 192.168.55.56, as the content of the target variable will execute this action on the system with the matching IPv4 adress. The script exited with a non-zero return code and the state of the action instance is set to unsuccessful.

  • An action which ran in step 1 of a fully automated runbook failed to reach the endpoint (for example because the server was not available) and the action could not be executed at all. The status of the action instance is failed. This status is reflected in the status of the execution. The execution will stop after the first step and report a failure.

Multi Target Actions

The other mode of operation of an action is the Multi Target Action (MTA). In order to execute an action as an MTA, specify the target string in the following format: [ $target1, $target2, …, $targetN ] or as a comma-separated list without square brackets: $target1, $target2, …, $targetN.

The following rules apply to MTAs:

  • If you use the format with brackets, then the target string must begin with a left square bracket ( [ ) and must end with a right square bracket ( ] ).

  • Define a list of systems separated by comma (,).

  • Duplicated entries are detected and ignored. This means specifying the same target multiple times will have no effect.

  • An empty list in the format [ ] is also allowed.

Multi Target Actions allow you to execute the same action on any number of targets in parallel, removing the necessity to execute the same action with different targets sequentially. If the target is specified in such a way, how the action is executed and how the results are treated will be different. The following criteria apply to MTAs:

  1. For every entry in the comma-separated list, the script will be executed on the specified target. Note: you cannot specify the same target more than once.

  2. All actions and information are summarized in one log. This log follows a specific format, see Output format of Multi Target Actions.

  3. The status of the execution will be executing as long as at least one execution is still ongoing and successful once all script processes are finished. The result will be successful even if some or even all actions reported unsuccessful, failed, or unknown.

  4. Specifying an empty array is allowed. No actual execution occurs, but an execution record is still created.

  5. The record will always report successful as its state. So if the runbook is executed fully automated, the runbook instance will proceed to the next step. This allows the use of multi-target automations as Conditional Automations: use the returned lists of previous multi-target automations in subsequent multi-target automations to only run the subsequent automation where the script in the previous automation was successful. Or where it was unsuccessful.

Examples:

  • An action receives [prod-server1] as the target. It will execute the script on the system prod-server1. The script exited with a non-zero return code. The status of the execution is successful. The output of the action instance contains information that this script execution was unsuccesful on prod-server1.

  • An action receives [prod-server1, prod-server2, prod-server3] as the target. It will execute the script on three systems in parallel. All scripts exit with zero as the return code. The output and status of each of the three script activities is written to the output. The status of the overall execution is successful.

  • An action receives [] as the target. This triggers the conditional action workflow No execution will take place. The execution record will have an almost empty output and the status will be successful.