Skip to main content

Playbooks

Playbooks are configurable automated processes that can be used to perform a variety of actions for a resource like config item, component, & check. They can also operate independently of any specific resource, providing versatility in handling different tasks and processes within a system or environment

Triggers

Context

Self-Service
Events
Webhooks
restrict-to-deployment.yaml
#...
kind: Playbook
spec:
# components: ...
# checks: ...
configs:
- types:
- Kubernetes::Deployment

Self-Service

Parameters

Playbooks have 2 types of parameters:

Resources

A playbook can be restricted to specific configs, components or health checks using resource selectors. For example Restarting a Kubernetes Deployment is only applicable to config items of type: Kubernetes::Deployment

scale-deployment.yaml
#...
kind: Playbook
spec:
configs:
- types:
- Kubernetes::Deployment
#....
User Input

Before running a playbook, users can provide input using parameters

parameters.yaml
#...
kind: Playbook
spec:
# user input
parameters:
- name: replicas
# ...

Events

Webhooks

Actions

Playbooks execute a sequence of actions (steps), these actions can update git repositories, invoke pipelines or run command line tools like kubectl and aws.

Templating

The actions values can be templated using Go Templates

restart-deployment.yaml
#...
kind: Playbook
spec:
configs:
- types:
- Kubernetes::Deployment
actions:
- name: 'Restart kubernetes deployment'
exec:
script: kubectl rollout restart deployment {{.config.name}} -n {{.config.tags.namespace}}

The parameters to the playbooks are available in the Context

Playbook Action Logs

Runners

Approvals

Authorization safeguards can be applied to playbook runs, ensuring their execution is limited to specific individuals or teams who grant approval.

approve-kubernetes-scaling.yaml
#...
kind: Playbook
spec:
#...
approval:
type: any
approvers:
people:
- admin@local
teams:
- DevOps
FieldDescriptionSchemeRequired
typeHow many approvals required. Defaults to allany or allfalse
approvers.[]peopleLogin or id of a personPeoplefalse
approvers.[]teamsName or id of a teamTeamfalse