Multiple environments
The default behavior of the runbook is "one runbook one environment". Usually this is more than enough but there are cases where the workflow requires multiple environments. To achieve this we have to make changes the environment
section and the tasks.
Environment section
In the environment
section we can pass array (multiple) environments. For each environment we have to specify two new properties::
- name - unique (user defined) name of the cluster
- default -
boolean
. Only one environment can be set as defaulttrue
. For each task we can specify against which environment it should be ran. But this can make the runbook a bit too descriptive. Because of this the task environment property is set as optional. Ifenvironment
is not specified for the task(s) then the task will be ran against the environment which is set asdefault: true
. For all other environments here we have to explicitly setdefault: false
.
1 2 3 4 5 6 7 8 9 |
|
Tasks
If multiple environments are to be used then we can specify environment
property for the tasks. This property will indicate which environment config to be used when executing the task.
In the example below we have 3 tasks:
Get some streams
will be ran againstCluster 1
configGet some apps
will be ran againstAnother cluster
configGet some other apps
- this task is missing theenvironment
property. This will make it run against the environment config for whichdefault
is set totrue
. In the example below this will beCluster 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|