To create a Runbook, add a file with name RunbookName.js in the folder <BUILD_DIR>\CONFIGURATION\HERO\runbook (spaces in the file name are not allowed).
The file content must be the following:
function getRunBook() {
var returnValue = {};
returnValue = {
actionID: "RunbookName",
author: "John Nash",
name: "Cool RunBook",
description: "This runbook is very cool,
component: "component_name",
summary: "This is a test runbook",
commands: "a command %HOME_DIR% with the first parameter = %PARAM1%, the second one = %PARAM2% and the last one=
%PARAM1%__%PARAM1% - - %PARAM_LIST% and that's it",
os: "linux",
rating: 0,
docLink: "http://www.google.com",
readonly:true,
parameters: [
{
"name": "PARAM1",
"type": "string",
"value":"",
"default":"my_name"
},
{
"name": "PARAM2",
"type": "number",
"value": "",
"default": "123"
},
{
"name": "PARAM_LIST",
"type": "collection",
"value": "",
"default": "two",
"options": ["one","two","three"]
}
]
}
return JSON.stringify(returnValue);
}
Note: returnValue is where you define the runbook json.
You must define the following parameters:
actionID |
The unique ID of the runbook. It must be equal to the name of the file. Spaces are not allowed |
author |
The author of the runbook |
name |
The name of the runbook |
description |
The description of the runbook |
component |
The list of the components where the runbook can run |
summary |
An explanation of what the runbook does |
commands |
A list of commands that will run on the machine |
os |
Tthe operative system where the runbook can run |
rating |
The runbook usefulness. It is updated by the users |
docLink |
Link to the documentation |
readonly |
If true, the runbook script cannot be modified. Variables and parameters still work |
parameters |
The list of the parameters (name and type) inserted by the users from the UI |
After a new Runbook is added, run the following commands from the <BUILD_DIR> directory:
docker stop hero-tomcat
docker rm hero-tomcat
docker volume rm <BUILD_DIR>_hero-home (to remove the configuration volume)
docker-compose up --build -d