Overview
This article will show you how to set and then select from multiple hostname templates for provisioning VMs.
Example:
On the order page you could choose from the following options and the hostname would be set with the hostname example below:
Hostname Only
usernamesvr
Hostname Sequential
usernamesvr-00X
Hostname and Server Environment
usernamesvr-PROD
Hostname and Server Environment Sequential
usernamesvr-PROD-00X
Considerations
You will need to create a new Parameter for your custom hostname options
Procedure
1. Create New Custom Hostname Template Parameter
After your new Parameter has been created, add this to the environment(s) that this will be used on.
2. Add Any Controlling Parameters
If you have any parameters that you will be used in your Hostname, add that as a Controlling Parameter to your Custom Hostname Template parameter.
Select your Parameter with the dependency type of Regenerate Options
Example:
There is a custom parameter on an Environment called serverenv
that has the options of PROD, QA, and DEV.
3. Add an Action To Regenerate Options
The below code will generate options provided in the example in the Overview of this article:
def get_options_list(field, control_value=None, **kwargs): serverenv = control_value options = [ ("", "Hostname Only"), ("-00X", "Hostname Sequential"), ("-" + str(serverenv), "Hostname and Server Env"), ("-" + str(serverenv) + "-00X", "Hostname and Server Env Sequential"), ] return { 'options': options, }
4. Update the Hostname Template on the Server Tier item on the Build tab of your Blueprint
Select the pencil on your Server Tier build item and update the Hostname Template field.
Example:
If you are using the requestor’s username as the base of the Hostname your Hostname Template field would be:
{{requestor.username}}{{custom_hostname_template}}
5. You Now Have Multiple Hostname Template Options to Choose on Your Order Form
The dropdown for your custom_hostname_template
will now have your available options and will update the Hostname Preview.
0 Comments