Skip to main content

Automation ManagementAutomation Management Guide

Advanced Playbook Steps

Learn about steps, the building blocks for creating an advanced playbook.

A step is a set of instructions; it is what playbooks are composed of. When an advanced playbook triggers, it follows a sequence of steps until it reaches the last step. The result of a playbook is the result of the last executed step.

A step takes in data as input and, using the step instructions, transforms the data into an output. The output of a step can be used as inputs for subsequent steps.

There are four types of steps:

  • Actions – An action you create in the playbook or an existing action for a service.

  • For loops – Iterates over items in a list.

  • While loops – Executes a sequence of code indefinitely until it's stopped.

  • Branches – Splits the execution of the playbook based on a condition. There are two types of branches: branch one and branch all.

When you create any step, it is given a letter as an identifier. For example:

A playbook containing an action, for loop, and branch to one with their given identifiers highlighted in a red rectangle.

The action is given the identifier a, the for loop is given the identifier b, and the branch to one is given the identifier c.

For Loops

In an advanced playbook, iterate over items in a list using a for loop.

A for loop is a step that iterates over items in a list and runs an action on each iteration.

The input for a for loop is a list of items you define in the step or the result of a previous step that contains several items, depending on the iterator expression.

automationmanagement-advancedplaybook-forloop.png

You can configure a for loop so it skips failures and continues on to the next item in a list even if one of the items fail; iterates over the list items in parallel; and, if iterating over list items in parallel, assign a maximum number of iterations run in parallel.

While Loops

In an advanced playbook, execute steps indefinitely using while loops.

A while loop is a step that executes steps indefinitely until it's stopped.

automationmanagement-advancedplaybook-whileloop.png

There are three ways to stop a while loop:

  • When you manually run a playbook, you cancel the run.

  • For an action in the while loop, under Advanced > Early Stop, you define a predicate expression that determines the conditions under which the while loop stops running. If the action output meets the conditions, the while loop stops running.

You can configure a while loop so it continues to evaluate the next item even if one of the items fails.

Branches

Split the execution of an advanced playbook using branches.

A branch is a step that instructs the playbook to execute a different sequence of steps based on a condition. There are two types of branches:

  • Branch to one – If conditions are true, the branch is executed; if conditions are false, the default branch is executed. If several branches are true, the first branch whose conditions are evaluated to true is executed.

    A branch to one step with two branches.
  • Branch to all – All branches are executed, consecutively or in parallel.

    A branch to all step with two branches.

Collect result from all branches represents the end of the branch.