Hello, Playbook

REAL

A playbook is a YAML file. This is the smallest valid one: the four required keys, and a workflow with one step.

# Chapter 1.2: the smallest valid playbook. Four required keys, one step.
apiVersion: noetl.io/v2
kind: Playbook
metadata:
  name: minimal
workflow:
  - step: start
    tool:
      kind: rhai
      code: |
        "hello, playbook"
  • apiVersion: noetl.io/v2 and kind: Playbook say what the document is. They are the only accepted values.
  • metadata.name names it.
  • workflow is the list of steps. Each step has a name (step) and a tool. Here the tool is rhai, a small embedded scripting language, and the step's result is the value of its last expression.
  • The first step is called start. A NoETL server always begins an execution at start, so name your first step that.

Chapter 4 covers every key.

Adding an input and a second step

# Chapter 1.2: hello, with an input. The first step runs a shell command (local
# runtime field `cmds:`), the second a Rhai expression.
apiVersion: noetl.io/v2
kind: Playbook
metadata:
  name: hello
workload:
  who: world
workflow:
  - step: start
    tool:
      kind: shell
      cmds:
        - echo "hello {{ workload.who }}"
    next:
      - step: done
  - step: done
    tool:
      kind: rhai
      code: |
        40 + 2
  • workload holds the playbook's inputs, with defaults. A template reads them: {{ workload.who }}.
  • next sends control from start to done when start finishes.
  • The first step runs a shell command. Locally the commands go under cmds:. On a cluster the shell tool's field is command: instead (5.1). This example is for the local runtime.

Check your understanding