-
Notifications
You must be signed in to change notification settings - Fork 163
Tasks
Tasks control the actions that Razor performs on a node, most commonly the
installation of an operating system. A task consists of a metadata file,
and a number of ERB templates. Currently, the metadata file is a YAML file
with the name metadata.yaml
in a ${name}.task
folder in the tasks
folder. The task name supports a forward-slash /
, which allows tasks to
be physically organized in subfolders (eg. A task name of Windows/10
would
be stored in tasks/Windows/10.task
)
Here is a sample of that file's syntax, located at e.g.
tasks/some_task.task/metadata.yaml
:
os_version: 42
description: Some OS version 42
base: some_other_task
boot_sequence:
1: boot_install
2: boot_again
default: boot_local
This task is called some_task
since the folder name is some_task.task
.
The os_version
and description
fields should be self
explanatory. The base
field indicates this task is derived from
a different task, which affects how templates are found (below).
The boot_sequence
governs how Razor should respond to
repeated boot requests of a node. In the above example, on the first boot
request after a policy using this task has been bound to the node, the
server will respond with the boot_install.erb
template, on the second
boot request with the boot_again.erb
template, and on all following
requests with the boot_local.erb
template.
Templates are looked for in the following directories, in this order:
$name.task
-
$base.task
(if the task is derived from another) common
These directories are taken relative to the task_path
configuration
setting, which is a colon separated list of directories.
Templates can use the following helper functions:
-
file_url(template)
: the URL to the (interpolated) template; e.g., a kickstart script might download a post_install script withcurl <%= file_url("post_install") %> > /tmp/post_insall.sh
-
log_url(message, severity)
: generate a URL that, when a GET is issued against it, logsmessage
withseverity
against the current node -
store_url(vars)
: a URL that will store vars with the node on the server; currently onlyip
is supported as a variable -
repo_url(path)
: a URL topath
within the repo currently being installed, e.g.<%= repo_url("/isolinux/vmlinux") %>
-
config[key]
: the configuration value forkey