Recipes are scripts that DCImanager runs on a virtual machine after OS deployment from the template. They help prepare a virtual machine for specific operations: install packages, edit configuration files, etc. The scripts can be executed only on Linux machines.
The recipes is sent in the request from the cluster node to the control panel, and the control panel saves it on the disk in a temporary file and starts with the vzctl utility:
vzctl runscript CTID filename
You can select a recipe when you create a virtual machine. Learn more under VM management.
Tags are used to check that a recipe is compatible with an OS template. A recipe is compatible with the operating system if they have at least one similar tag.
You can select a recipe that will be executed on a virtual machine in Settings → Global settings → Recipe. The control panel saves the recipe name rather its id. Several recipes can have similar internal names, but different tags. During OS installation the first recipe with the selected name compatible with a template is selected. Therefore, you can set different recipes for different operating systems.
Recipe execution timeout is 3 hours.
Navigate to Cluster settings →Recipes.
Recipe repositories
Click Repositories→ Add.
- Repository — enter a name for the repository;
- URL— repository URL.
DCImanager defines templates available in the repository and add them into a list in Settings → Recipes.
Click Check to refresh the list of OS templates.
ISPsystem repository is added by default.
Recipe properties
Click Properties to set the parameters.
- Who can use this recipe:
- Available to all users;
- Available to admins;
- Not available — nor users or admins can use this recipe.
Creating a recipe
Click Add to add a new recipe.
Only administrators can create recipes.
To allow users to add recipes, add Option UserRecipes into the control panel Configuration file.
Recipe file structure
Metadata
The control panel uses the metadata:
- to display a recipe in a list of recipes;
- to choose an appropriate recipe according to cluster policy settings.
A block with comments containing the recipe metadata is added into the recipe body:
# metadata_begin
# recipe: hello_world
# tags: unix
# revision: 1
# description_ru:
# description_en:
# metadata_end
The metadata section begins with the key phrase metadata_begin, and ends with the key phrase metadata_end. The following metadata can be located between them:
- recipe: — a recipe internal name. Several recipes can have similar internal names;
- tags — a set of tags comma separated. They allow to check that a recipe is compatible with the OS template;
- revision — a recipe version;
- description_XX: — a brief description of a recipe on a certain language.
Macros
In recipes you can use macros that will be changed into corresponding values before the recipe is executed:
- ($TIMEZONE) — server timezone.