Passing deployment data using tokens
When creating service blueprints, you can use deployment data such as hostnames and IP addresses in your software packages and post deployment actions using tokens. This capability lets you easily deploy complex, high value services with parameters that are dynamically evaluated at runtime.
This topic includes the following sections:
Overview
You can define parameters as part of a service blueprint and at the option level for a particular resource set.
You can also use parameter tokens, such as HostName
and IP address
, that are defined or assigned in another resource set in the same blueprint. These tokens are applicable for software deployment, BMC Atrium Orchestrator workflows, SQL scripts or other scripts supported that BMC Database Automation supports as Actions, or any deployment scripts (such as BMC Server Automation NSH scripts).
For example, consider the following scenario:
- A service blueprint has a definition with a resource set that installs BMC AR System Mid-tier. This resource set requires the hostname of the BMC AR System server that was installed previously as a part of the initial resource set deployment in the same blueprint.
- Create a
hostname
variable in BMC Server Automation. ThehostName
variable is defined as a local property in the BMC Server Automation package that deploys the BMC AR System Mid-tier resource set. - When defining the resource set for the mid-tier deployment, create a token that obtains the hostname from the previous resource set which installed the BMC AR System Server.
- The BMC AR System Server deployment passes the AR hostName as a value to the
hostname
variable in BMC Server Automation.
Before you begin
- For information about setting up parameters in BMC Server Automation, see Parameterizing BLPackages by adding local properties and Parameterizing NSH scripts.
- For information about setting up parameters in BMC Database Automation, see Using parameters in PaaS provisioning .
- For information about sequencing the application deployments as part of a service blueprint definition, see Creating, copying, or editing a service blueprint.
Including a pre-defined parameter token in a service blueprint
In the Service Designer workspace, open a service blueprint for editing.
Do one of the following:
If you want to configure parameters... Then... At the service blueprint level Select Service Properties > Parameters.
At the definition level Select Definition > Parameters. At the server level Select a server within a server group and then click Parameters in the edit pane. At the application level Select an application and then click Parameters in the edit pane. At the database instance level Select a database instance and then click Parameters in the edit pane. - In the Parameters table, click New .
Enter a unique parameter name. This name must be the same name as the one used in a BMC Server Automation package or script or in a BMC Database Automation template or Action. For example, if the parameter in the BMC Server Automation component template has a name of domainControllerName, then you must use the same name as the parameter in BMC Cloud Lifecycle Management.
- Optionally, in the Label field, enter the name that is displayed to the end user for this parameter.
- Optionally, enter a short description for your reference.
Select a data type of Token.
Note
You cannot modify data types later.
The Token type option is displayed.
Select the Token Type. Depending on which token type you select, only specific options are displayed. The options are combined to build the path of the attributes included in the resource set that uses the token. The following token types are available, each with applicable sub-options:
Token Type
Available sub-options
Hostname
Make the following selections:
- Group—Select the server group to which the token applies.
- Compute Instance #—Select the instance number of the server to which the token applies.
The Hostname option is only available when defining parameters for definitions or service properties.
IP Address
Make the following selections:
- Group—Select the server group to which the token applies.
- Compute Instance #—Select the instance number of the server to which the token applies.
- NIC #—Select the network interface card number to which the token applies. If the NIC is using network address translation (NAT), a NAT Address checkbox is displayed. Check the Network Resources tab for the server and see if the NIC has a NAT address assigned. If so, select the NAT Address checkbox.
The IP Address option is only available when defining parameters for definitions or service properties.
Virtual IP Address (VIP)
Make the following selections:
- Group—Select the server group to which the token applies.
- Load Balancer Pool Name—Select the name of the virtual load balancer pool to which the token applies.
- Client Port—Select the client-facing port number. This is the port number the client uses when addressing the load balancer pool.
The Virtual IP Address (VIP) option is only available when defining parameters for definitions or service properties.
Advanced Editor
Make the following selections:
- Token Path Type—This option controls the default token path provided in the Token Path text field.
- Token Path—Specify the path to the token for your compute or PaaS resource.
Advanced Editor is the only available option when defining parameters for applications or servers.
Optionally, click Required Value.
Note
If you choose to make the parameter required, then there must be a value for the token, otherwise the related action will fail. Also, if this option is not marked as a Required Value but is required in BMC Server Automation or BMC Database Automation, the related action would fail if the evaluation of token does not result in any value.
- Click OK to save the new parameter.
You can continue editing other aspects of the service blueprint. If you are done making changes, you can check it in to the Blueprint Library. See Creating, copying, or editing a service blueprint for detailed information.
Note
You can also use tokenized parameters when setting up option choices for the end-user in a service blueprint. See Configuring end-user Option Choices in service blueprints for information about defining option choices.
Creating a custom token
- Follow steps 1 through 7 in Including a pre-defined parameter token in a service blueprint.
- Select a Token Type of Advanced Editor.
- Select a Token Path Type of Compute or PaaS, depending on the type of resource you are deploying.
Click the Token Path field to open the field for editing.
The field contains a default token for PaaS or compute provisioning.
Compute token path:/ResourceSet[name=<value>]/ComputeContainer[0]/Server/ServerNetworkInterface[nicNumber=<value>]/IPAddress[isPublic=false]/ipAddress
PaaS token path:/ResourceSet[name=<value>]/SoftwareContainer[0]/<attr-name>
- To select another predefined token path, click . A list of token paths appears. Scroll through the list and select another token path.
- Edit the token string as needed.
You can edit text that is enclosed in angle brackets ( < > ). Optionally, you can also create your own token string. For examples of how you would construct a token, see Token examples. Optionally, click Required Value.
Note
If you choose to make the parameter required, then there must be a value for the token, otherwise the related action will fail. Also, if this option is not marked as a Required Value but is required in BMC Server Automation, the related action would fail if the evaluation of token does not result in any value.
Click OK to save the new parameter.
Note
If you edit the name of a resource set or delete a resource set, the tokens you have created that reference that resource set must be updated manually to reflect the change.
- You can continue editing other aspects of the service blueprint. If you are done making changes, you can check it in to the Blueprint Library. See Creating, copying, or editing a service blueprint for detailed information.
Token examples
A token is formed based on following rules.
- The path elements must be BMC Cloud Lifecycle Management object model class names.
- The conditions inside the path elements must contain the actual relation and attribute names.
- EQUALS (=), NOT EQUALS (!=), LESS THAN (<), GREATER THAN (>), LESS THAN OR EQUAL (<=) and GREATER THAN OR EQUAL (>=) are allowed
- AND (&), OR (|) Logical Operators are allowed
- Conditions for a path element cannot contain both logical operators (that is, both AND and OR).
Valid example:
/ResourceSet[name=RS1&tags.name=T1]/ ComputeContainer/Server/ServerNetworkInterface/IPAddress[isPublic=true| isPublic=false]/ipAddress
Invalid example:
/ResourceSet[name=RS1&tags.name=T1|tags.tagGroup.name=TG1]/ ComputeContainer/Server/ServerNetworkInterface/IPAddress[isPublic=true| isPublic=false]/ipAddress
Tokens must start with either a forward slash ( /
) or two forward slashes ( //
). These notations have different meanings:
/
— Indicates that the path is to be evaluated for current context//
— Indicates that the path is to be evaluated generically (do not bind to current context only).
The following table provides some examples for how you would format token values.
Token name | Token value | Resolves to |
---|---|---|
RS | The resource sets that match the specified tag and tag group | |
HOSTNAME | ??RS??/ComputeContainer/ Server[1]/hostname | The actual host name (for example, abcd.bmc.com). The number in the square brackets is an index relative to the compute container. For example, 0 would reference the first Compute container and 1 would indicate the second compute container.
. |
SERVERNAME | /Server[1]/hostName | The host name of the second server, in context of current SOI request |
Here is an example of a token used in a multi-tier service blueprint that is deploying both a server and a database. The server deployment includes an application that provisions BMC Server Automation. Configuring BMC Server Automation requires a connection to a database. The application that deploys BMC Server Automation can include a token like the following, which provides the name of the provisioned database:
/ResourceSet[name=PaaS_1]/SoftwareContainer[0]/name
Comments
Log in or register to comment.