Rules are part of the playbook engine. Rules enable using output from one node as input into another based on filtering criterions and enable selection of different execution paths in a playbook.

 

Rules are specified as part of playbook editing/creation and are specified at a per node level.


Example 1: Send an output parameter from one Node to next


Take a look at the Playbook where we are launching a Pager Duty incident, a Zoom meeting and a Slack channel and passing the information as a Slack message to a user. 



Our goal is to save the Zoom meeting URL and pass on in a message over Slack channel. As a first step towards that, select "Arguments" for the Zoom node as shown below.




Next, select "Rules" and save the output of parameter "join_url" into a variable as shown below.



Now select the "Slack-send-notification" Node where we wish to pass on the Zoom meeting URL and include it in the "message" under "Command" as shown below.




This will send the Zoom URL in the Slack message to the specified user.


Example 2: Send an output parameter to another Node only on matching a filter action


Take a look at the Playbook below. It gets the status of VMs running at EC2 and sends a different message over Slack depending on if VMs are running or not.




First, configure "Rules" under "Arguments" for the "EC2-slack-message-test" Node as shown below. Here we are matching Attribute "State Name" to "running" and then configuring an "Assign Path" to take color green. At the same time we are also storing the values of "InstanceId" and "InstanceType" into variables that we can use in our Slack message later on.



Based on the status of the VM, the Playbook will take correct conditional path and execute the corresponding Slack node as shown below.