# What is a PlayBook and what is  core components of a playbook?

A playbook is a set of instructions that a Doctor Droid bot or an on-call engineer follows during a production incident.

%[https://www.youtube.com/watch?v=T9KfunP9juA] 

A playbook consists of tasks. A task is an instruction that's executed through the portal. Let's create a task.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724840709790/2960d410-97b9-42fb-abf2-00ea44a219ff.png align="center")

A task could involve fetching a metric from CloudWatch or running a kubectl command on a server. Let's create a new task to fetch logs from CloudWatch.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724840729590/cc3f65df-7422-4fc9-9e85-59d9c8a93bf7.png align="center")

Add notes to the playbook. A note is a custom guideline for the user, related to the playbook or a specific step. Add a note indicating that this task fetches logs.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724840747525/cbc11b6f-1457-4ebd-94cc-a1866bffea67.png align="center")

Hover over a step to view the note. It's also possible to add multiple tasks in a step. For instance, fetch a Datadog metric. After adding the task, check the metric.

Add variables to the playbook. For example, add a service as a variable. To use the variable, enter a dollar sign followed by the variable name.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724840778752/000962cf-194b-4657-ae61-25500891e62e.png align="center")

Add a step with conditions. A condition is a rule that determines whether a certain action should be taken. For example, check logs from CloudWatch and check if the row count equals six. Then add a task. Add a metric and run the task.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724840806580/e5084c2e-9815-441d-b211-79df2c44e023.png align="center")

Save the playbook. Execute the playbook and observe the results with the condition. If the condition isn't met, the step isn't recommended and the next step is executed.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724840835236/8cffe674-b6f0-47f2-9f0f-b293faaf63b8.png align="center")

These are all the core components of a playbook.
