Self Service
Playbooks can be manually triggered on a component, config item or a check. If any of the playbook's resource filters matches the type and tags of the component, config or a check then a playbook run dropdown can be seen on that item.
restart-deployment.yamlapiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
  name: restart-deployment
spec:
  description: Restart deployment
  configs:
    - types:
        - Kubernetes::Deployment
  actions:
    - name: kubectl rollout restart deployment
      exec:
        script: kubectl rollout restart deployment {{.config.name}} -n {{.config.tags.namespace}}

Parameters
scale-deployment.yamlapiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
  name: scale-deployment
spec:
  description: Scale Deployment
  configs:
    - types:
        - Kubernetes::Deployment
  parameters:
    - name: replicas
      label: The new desired number of replicas.
  actions:
    - name: kubectl scale
      exec:
        script: |
          kubectl scale --replicas={{.params.replicas}} \
            --namespace={{.config.tags.namespace}} \
            deployment {{.config.name}}
Playbook parameter defines a parameter that a playbook needs to run.
| Field | Description | Scheme | Required | Templatable | 
|---|---|---|---|---|
name | Name of parameter. | string | true | |
default | Default value of the parameter. | string | true | |
label | Label of the parameter. | string | true | |
required | Specify if the parameter is required | bool | ||
icon | Icon | |||
description | Description of the parameter. | string | ||
type | Type of parameter. (Defaults to "text") | string | ||
properties | Properties of parameter. Varies based on the type | map[string]string | 
Defaulting
Parameter values can be defaulted from the selected resource
default parameters.yaml#...
kind: Playbook
spec:
  parameters:
    // Use the config items type and name in the parameter
    - default: 'chore: update $(.config.type)/$(.config.name)'
When running the playbook on a Deployment named mysql the following will be prepopulated:
Types
| name | Description | UI Component | Schema | Properties | 
|---|---|---|---|---|
check | Limits the value to a check. | Dropdown | string | Check | 
checkbox | Boolean value toggle | Checkbox | boolean | - | 
code | Text area | Code Editor | string | Code | 
component | Limits the value to a component. | Dropdown | string | Component | 
config | Limits the value to a config item. | Dropdown | string | Config | 
list | Specify a custom list of values | Dropdown | string | List | 
people | Limits the value to people. | Dropdown | string | People | 
team | Limits the value to teams. | Dropdown | string | - | 
text | Text input | Text Input | string | Text | 
component
| Field | Description | Schema | 
|---|---|---|
filter.type | Limit the components to the given type | string | 
config
| Field | Description | Schema | 
|---|---|---|
filter.type | Limit the components to the given type | string | 
checks
| Field | Description | Schema | 
|---|---|---|
filter.type | Limit the components to the given type | string | 
code
| Field | Description | Schema | 
|---|---|---|
language | e.g. yaml, json, toml, etc. | string | 
people
| Field | Description | Schema | 
|---|---|---|
role | Limit the people to the given role | `string | 
text
| Field | Description | Schema | 
|---|---|---|
multiline | Render a multiline textarea | boolean | 
list
| Field | Description | Schema | 
|---|---|---|
options[].label | Specify label of the list option | string | 
options[].value | Specify value of the list option | string | 
Fig: Playbook on a config item
Fig: Playbook parameters