HP Insight Control Server Provisioning 7.2 Online Help

Table Of Contents
6.3 Creating scripts
To create a script, you must make a copy of an existing script and then modify it. See “Copying
scripts (page 64) for details.
HP provides script templates with the appliance. See “Create a new script” (page 31) for more
information.
6.4 Custom attributes for scripts
“Overview of custom attributes in scripts (page 65)
“Examples of custom attributes in scripts (page 65)
“Rules for custom attributes in scripts (page 65)
6.4.1 Overview of custom attributes in scripts
A custom attribute is a simple name/value pair that is used as a form of variable substitution in
scripts and other appliance functions. When referenced, the custom attribute name is replaced by
the value of that custom attribute. Custom attributes do not stand alone; they are always associated
with an object in the management database, such as servers, groups, or OS Build Plans. Custom
attributes can be inherited from a containing object.
Custom attributes substitute specific values into scripts, configuration files, and package paths when
an OS Build Plan is run. This is useful for configuring installation processes, including network and
server configuration. Custom attributes are typically used for overriding default values.
When using custom attributes in script code, use the format:
@name@
or
@name:default_value@
where name is the custom attribute name and default_value is the value that will be used if
this custom attribute is not found in the appliance database. Defining a default value is optional.
Custom attributes may be entered in the appliance database via the UI as described in “Editing
OS Build Plan custom attributes (page 57) and “Editing custom attributes for a server” (page 38).
System wide (default value) custom attributes may be viewed from the Settings screen in the UI.
6.4.2 Examples of custom attributes in scripts
If a custom attribute is defined using the UI as name MediaServer and value 10.1.1.2,
you may reference it in a script with @MediaServer@. When the OS Build Plan is run on a
server, @MediaServer@ will be replaced with 10.1.1.2.
If your script contains the code @Password:ChangeMe123!@ and the custom attribute
Password is not defined via the UI, when the Build Plan is run the custom attribute Password
is not found in the appliance database so Password will be replaced with ChangeMe123!.
6.4.3 Rules for custom attributes in scripts
The name may not contain spaces or special characters. It may contain numbers, underscores,
and dashes.
The value can contain special characters and spaces, may be multiple lines, and you may
also leave it blank. Special characters might require double quotes if the value will be executed,
for example echo hello > temp.txt”.
You may not use a custom attribute within a custom attribute value.
You may not have duplicate custom attribute names for an individual OS Build Plan.
6.3 Creating scripts 65