Now that you have successfully created and executed a single node playbook, lets create more complex playbooks.


You can take a look at the video or follow our step-by-step guide below.




Step 1: Editing an existing playbook


Now lets add more complexity to the Playbook we created earlier. Our objective was to send the status of the AWS EC2 instances as a message to a Slack channel.


Select your previously saved Playbook EC2-Slack-Message-Test from the left side panel.




Next, drag a blank node on to the canvas and select "SlackV2" connector and action "send-notification" from left side panel as shown below.



We will be adding TWO slack nodes to the canvas. One will send a message "VMs are not running" to the user and other will send InstanceID and InstanceTypes of those VMs which are running to the user. Both the nodes will be connected through conditional logic as explained below.


First lets complete the configuration for the "VMs not running" message node as shown below.



Step 2: Add conditional logic to a multi-node Playbook


Now, in order for this conditional logic to work, we need to adds "Rules" to the EC2-slack-message-test Node. Select the node, and click "Rules" under "Arguments" tab and it will open up the Rules Configuration window as shown below.


The values of ID and Types  for the matched instances are stored in variables "InstanceID" and "InstanceType" as shown below. 



Next, drop another blank node and configure it to be the "VMs are running" message node as shown below. Here you can use the values of variables "InstanceID" and "InstanceType" by using {{InstanceID}}{{InstanceType}} as shown below in the message that is passed to the user in a slack channel.




A fully inter-connected Playbook with conditional logic looks like this.



Step 3: Run your multi-node Playbook


Now we are ready to execute this Playbook by clicking on "Run".




Note the output under "Output" tab.




You can check the output associated with a Node by clicking on that node.




Congratulations on first successful execution of a multi-node conditional logic playbook!


You should now try out creating Playbooks to automate tasks that are repetitive in nature and that can save you time.