Single and Multi-Target Automations

You can use single-target or multi-target automations to run script automations.

Single Target

The parameter with the name target has special meaning to script automations as it defines the system on which the automation runs. The system can be defined by a short hostname, an FQDN, or an IP address. When run, a script automation connects to the system identified by the target and runs the script there.

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

Examples:
  • An automation that receives prod-server1, as the content of the target variable runs this automation on the system prod-server1. The script is exited with return code of zero and the state of the automation instance is set to successful.
  • An automation that receives 192.168.55.56, as the content of the target variable runs this automation on the system with the matching IPv4 address. The script is exited with a nonzero return code and the state of the automation instance is set to unsuccessful.
  • An automation, 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 automation could not be run at all. The status of the automation 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 Automations

The other mode of operation of an automation is the Multi Target Automation (MTA). To run an automation 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. Specifying the same target multiple times has no effect.
  • An empty list in the format [ ] is also allowed.
With Multi-Target Automations, you can run the same automation on any number of targets in parallel, removing the necessity to run the same automation with different targets sequentially. If the target is specified in such a way, how the automation is run 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 is run 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 Automations.
  3. The status of the execution will be executing while at least one execution is still ongoing and successful when all script processes are finished. The result is successful even if some or all automations are 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 automation receives [prod-server1] as the target. It executes the script on the system prod-server1. The script is exited with a nonzero return code. The status of the execution is successful. The output of the automation instance contains information that this script execution was unsuccesful on prod-server1.
  • An automation receives [prod-server1, prod-server2, prod-server3] as the target. It runs 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 executions is written to the output. The status of the overall execution is successful.
  • An automation receives [] as the target. This triggers the conditional automation workflow No execution takes place. The execution record has an almost empty output and the status is successful.