Chapter 5. Catalogs and Services
Through the use of catalogs, Red Hat CloudForms provides support for multi-tier service provisioning to deploy layered workloads across hybrid environments. You can create customized dialogs that will give consumers of the services the ability to input just a few parameters and provision the entire service. The following table lists the terminology associated with catalogs that you will use within the CloudForms user interface for service provisioning.
Table 5.1. Terminology
| Type | Information |
|---|---|
| Catalog Bundle | A group of templates. |
| Catalog Item | A single template. |
| Template | A template is a copy of a preconfigured virtual machine, designed to capture the installed software and software configurations, as well as the hardware configuration of the original virtual machine. |
| Dialog Tabs | Part of a service dialog. |
| Element | An item on a tab in a dialog. It can be a button, check box, drop down list, radio button, tag control, text area box, or a text box. |
| Provisioning Dialogs | Dialogs created for host provisioning, virtual machine migration, or virtual machine provisioning. The dialog name must be added to the appropriate provision instance to be processed. |
| Service Catalog | A catalog item or catalog bundle that is available for provisioning. |
| Service Dialogs | Made up of fully customizable tabs, items, and values for use with service provisioning. |
5.1. Service Dialogs
When provisioning a service, input will be needed from the requester. Service dialogs are used to take input from the user. This input is connected to a method in the Automate model that defines how the users input is translated into the provision request. Before creating a service dialog, be sure to plan what items you need the user to input.
5.1.1. Adding a Service Dialog
When creating a service dialog for use with Ansible playbook catalog items, variable elements must use the prefix param_ when assigning the value. For example, a new variable labeled key1 should have its value set as param_key1.
- Navigate to → .
- Click the Service Dialogs accordion.
-
Click
(Configuration), and then
(Add a new Dialog).
In Dialog Information, enter a Label and Description. Check the boxes for the buttons you want available at the bottom of the dialog form. The description will appear as hover text.
As you enter the Label of the dialog, it should appear in the Dialog pane on the left.
-
Click
(Add), then
(Add a New Tab to this Dialog).
Enter a Label and Description for this tab.
As you enter the Label of the tab, it should appear in the Dialog pane on the left under the dialog you are creating.
-
Click
(Add), then
(Add a New Box to this Tab).
Enter a Label and Description for this box.
As you enter the Label of the box, it should appear in the Dialog pane on the left under the tab you are creating.
-
Click
Add an element to this box. Elements are controls that accept input.
-
Click
(Add), then
(Add a New Element to this Box).
Enter a Label, Name, and Description for this element.
ImportantName must use only alphanumeric characters and underscores without spaces. It is also used to retrieve the value of this element in the method used with the dialog and must start with dialog_service_type
Select a Type for an element type. All Type options have a Required and Default Value field. Check Required or set Required to true if the element is required to proceed. You can also specify a default value. The rest of the options presented are based on which type of element you select.
Element Types Additional Info Check Box
Check Default Value if you want this check box checked by default.
Date Control
Use Date Control to create a field where users can select a date. If you want users to be able to select a date and time, use the Date/Time Control option.
Date/Time Control
Use Date/Time Control to create a field where users can select a date and time. Only one Date Control or Date/Time Control element can be present in a dialog.
Drop Down Dynamic List
Use Drop Down Dynamic List if you want the list options to be created using automate methods. Use Entry Point (NS/Cls/Inst) to select an automate instance. Check Show Refresh Button to allow users to refresh the list options manually.
Radio Button
This element type serves the same purpose as Drop Down List but displays options using radio buttons.
Tag Control
Select a Category of tags you want assigned to the virtual machines associated with this service dialog. Check Single Select if only one tag can be selected.
Text Area Box
Provides text area for users to enter some text. You can also leave a message to users by typing in the Default Value field or leave it as blank.
Text Box
This element type serves the same purpose as Text Area Box with the option to check Protected so the text is shown as asterisks (*), instead of plain text.
-
Click
- Continue adding the dialog items you need. You can switch between dialogs, tabs, boxes, and elements by selecting their respective labels from the Dialog pane on the left.
- Click Add. Your dialog should appear in the Service Dialogs accordion.
5.1.2. Importing Service Dialogs
You can share service dialogs between appliances using the export and import features.
- Navigate to → .
- In the Import/Export accordion, click Service Dialog Import/Export.
- In the Import area, click Browse to select an import file.
- Click Upload.
5.1.3. Exporting Service Dialogs
You can share service dialogs between appliances using the export and import features.
- Navigate to Automate → Customization.
- In the Import/Export accordion, click Service Dialog Import/Export.
- In the Export area, select the service dialogs that you want to export.
- Click Export.
5.2. Methods
5.2.1. Creating a Method to Associate with the Dialog
You will need to create a method that connects the values in the dialog with the provisioning request. The method should be created in the DOMAIN/Service/Provisioning/StateMachines/ServiceProvision_Template class of the Automate model.
DOMAIN must be a user-defined Domain and not the locked ManageIQ Domain. If necessary, you can copy the class from the ManageIQ domain into a custom domain.
A method is provided below that was created for the following scenario:
- You want to provision a three-tiered service that contains catalog items of web, app and DB. Each of these virtual machines (or cloud instances) has been tagged under the Service category with the appropriate value. Then, added as a catalog item and combined into a catalog bundle.
- The Service Dialog captures the selection of small, medium or large application in a dropdown called service_type. When referring to a value captured in an element in a dialog, the name of the element should be prefixed with dialog_. For example, service_type becomes dialog_service_type when used in the method.
- The method will set the memory sizes for each of the catalog items based on the service_type selection.
# Automate Method
#
$evm.log("info", "Automate Method ConfigureChildDialog Started")
#
# Method Code Goes here
#
$evm.log("info", "===========================================")
$evm.log("info", "Listing ROOT Attributes:")
$evm.root.attributes.sort.each { |k, v| $evm.log("info", "\t#{k}: #{v}")}
$evm.log("info", "===========================================")
stp_task = $evm.root["service_template_provision_task"]
$evm.log("info", "===========================================")
$evm.log("info", "Listing task Attributes:")
stp_task.attributes.sort.each { |k, v| $evm.log("info", "\t#{k}: #{v}")}
$evm.log("info", "===========================================")
#############################################################
#### This is how the method would look for dialog variables
#############################################################
dialog_service_type = $evm.root['dialog_service_type']
$evm.log("info","User selected Dialog option = [#{dialog_service_type}]")
stp_miq_request_task = stp_task.miq_request_task
#$evm.log("info","(parent) miq_request_task: = [#{stp_miq_request_task}]")
#############################################################
#### This is how you get the catalog items for the catalog bundle
#############################################################
stp_miq_request_tasks = stp_task.miq_request_tasks
#$evm.log("info","(children) miq_request_tasks count: = [#{stp_miq_request_tasks.count}]")
#############################################################
#### By going through the children, you can set the dialog variable for each of the children (we based our values on the childrens service tags)
#############################################################
stp_miq_request_tasks.each do |t|
$evm.log("info"," Setting dialog for: #{t.description}")
service = t.source
service_resource = t.service_resource
#$evm.log("info"," Child service resource name: #{service_resource.resource_name}")
#$evm.log("info"," Child service resource description: #{service_resource.resource_description}")
service_tag_array = service.tags(:app_tier)
service_tag = service_tag_array.first.to_s
memory_size = nil
#############################################################
#### The dialog_service_type is the attribute set on the service dialog
#### We use the service_tag to decide what child gets what dialog
#############################################################
case dialog_service_type
when "Small"
case service_tag
when "app"
memory_size = 1024
when "web"
memory_size = 1024
when "db"
memory_size = 4096
else
$evm.log("info","Unknown Dialog type")
end
when "Large"
case service_tag
when "app"
memory_size = 4096
when "web"
memory_size = 4096
when "db"
memory_size = 8192
else
$evm.log("info","Unknown Dialog type")
end
else
$evm.log("info","Unknown Dialog type - setting Dialog options here")
end
#############################################################
#### set_dialog_option sets the dialog for the child
#############################################################
t.set_dialog_option('memory',memory_size) unless memory_size.nil?
$evm.log("info","Set dialog for selection: [#{dialog_service_type}] Service_Tier: [#{service_tag}] Memory size: [#{memory_size}]")
end
#
#
#
$evm.log("info", "Automate Method ConfigureChildDialog Ended")
exit MIQ_OK5.2.2. Creating a Method in the Service Class
Service methods have been split based on purpose.
- Navigate to → .
Service Class is located at → → → → and → → → → .
NoteDOMAIN must be a user-defined Domain and not the locked ManageIQ Domain. If necessary, you can copy the class from the ManageIQ domain into a custom domain.
- Click the Methods tab.
-
Click
(Configuration), then
(Add a New Method).
- Enter a Name and Display Name.
- In the Data field, enter the method contents.
- Click Validate and wait for your data entry to be successfully validated.
-
Click Add.
5.2.3. Creating an Instance in the Service Class
- Navigate to → .
Service Class is located at → → → → and → → → → .
NoteDOMAIN must be a user-defined Domain and not the locked ManageIQ Domain. If necessary, you can copy the class from the ManageIQ domain into a custom domain.
- Click the Instances tab.
-
Click
(Configuration), then
(Add a new Instance).
- Enter a Name and Display Name.
- In the Fields area, enter the method’s name in Value.
- Click Add.
The instance is created so that it can be called from the ServiceProvision class.
After the method has been created, it must be mapped to an instance in the DOMAIN/Service/Service/Provisioning/StateMachines class. The name of the instance must be specified as the Entry Point. This method must be called before the provision job begins.
5.2.4. Associating a Method with an Automate Instance
Service methods have been split based on purpose.
- Navigate to → .
- From the accordion menu, click the required service method.
Service Class is located at → → → → and → → → → .
NoteDOMAIN must be a user-defined Domain and not the locked ManageIQ Domain. If necessary, you can copy the class from the ManageIQ domain into a custom domain.
- Either create a new instance or select the clone_to_service instance.
-
Click
(Configuration), then
(Edit Selected Instance).
- In the configurechilddialog value, put the path to the method.
- Click Save or Add if you are adding this to a new instance.
5.3. Catalogs
Catalogs are used to create groups of virtual machines or instances for provisioning. For example, a complete package of a database server, desktop with specialized software already on it, and a firewall. You will need to complete the following steps to create and provision a service catalog.
- Create Catalog Items for each virtual machine or instance that will be part of the service.
- Create a Service dialog. For example, create a dropdown with three options small, medium, and large.
- Create a method for the Service Dialog. This method defines what each of the options means to each of the individual virtual machines or cloud instances for the service. This method is called from a service provisioning instance in the Automate model.
Create an instance in the
DOMAIN/Service/Provisioning/StateMachines/ServiceProvision_Templateclass that calls the method.NoteDOMAIN must be a user-defined Domain and not the locked ManageIQ Domain. If necessary, you can copy the class from the ManageIQ domain into a custom domain.
- Associate method with Automate instance.
-
Create a Catalog Bundle, adding each of the catalog items to it. Select the Service Dialog you created. Use the instance created in the
DOMAIN/Service/Provisioning/StateMachines/ServiceProvision_Templateclass as the Entry Point. Check Display in Catalog box. - Provision a service.
5.3.1. Creating a Catalog Bundle
- Navigate to → .
- Click the Catalog Items accordion.
-
Click
(Configuration), and then
(Add a New Catalog Bundle).
-
In Basic Info, enter a name and description:
- Click Display in Catalog.
- Select the appropriate dialog name.
- Select the path to the appropriate ServiceProvision instance.
- Click on the Resources tab, then select the catalog items you want added to the bundle from the Add a Resource dropdown.
- Click Add.
A catalog bundle is created and visible in the Service Catalog accordion.
You should also create and specify an Entry Point in the DOMAIN/Service/Provisioning/StateMachines/Methods/CatalogBundle class for each catalog item that is part of a bundle. If you do not, then the pre and post provision processing will occur for each item in the bundle in addition to processing for the Catalog Bundle. To set the entry point, go into each Catalog Item and check Display in Catalog. Then, you will see the Entry Point field.
5.3.2. Creating a Catalog Item
Create a catalog item for each virtual machine or cloud instance that will be part of the service.
- Navigate to → .
- Click the Catalog Items accordion.
-
Click
(Configuration), and then
(Add a New Catalog Item).
Select the Catalog Item Type you are adding. The dialogs that appear will be filtered based on the selected type of provider. For example, you will only see templates residing on Red Hat Providers, if the Catalog Item Type is Redhat.
In the Basic Info subtab:
- Type a Name/Description.
Check Display in Catalog to edit Catalog, Dialog, and Entry Point(NS/Cls/Inst) options.
- Provisioning Entry Point (Domain/NS/Cls/Inst) requires you to select an Automate instance to run upon provisioning.
Retirement Entry Point (Domain/NS/Cls/Inst) requires you to select an Automate instance to run upon retirement.
NoteThe entry point must be a State Machine since the Provisioning Entry Point list is filtered to only show State Machine class instances. No other entry points will be available from the Provisioning Entry Point field.
NoteYou can only choose from the catalogs and dialogs you have already created. If you haven’t done so, leave the values blank and edit later.
- In the Details subtab, write a Long Description for the catalog item.
- In the Request Info subtab, select provisioning options that apply to the provider chosen. For more information, refer to the sections on Provisioning Virtual Machines and Provisioning Instances.
- Click Add.
5.3.3. Creating a Generic Catalog Item
Create generic catalog items for services non-specific to virtualization or cloud environments. This catalog item type can serve a wide array of needs, from creating a vLAN across a network to accessing virtual machine IP addresses and adding them to a load balancer pool.
- Navigate to → .
- Click the Catalog Items accordion.
-
Click
(Configuration), and then
(Add a New Catalog Item).
- Select Generic from the Catalog Item Type list.
In the Basic Info subtab:
- Type a Name/Description.
- Check Display in Catalog to display the item in the catalog. A Dialog will be required if you select Display in Catalog.
- Choose a Catalog to which to add the new item.
- Select a Dialog from the available options.
- Choose a Subtype from the list menu.
Add Entry Point(NS/Cls/Inst) options.
- Provisioning Entry Point (Domain/NS/Cls/Inst) requires you to select an Automate instance to run upon provisioning.
Retirement Entry Point (Domain/NS/Cls/Inst) requires you to select an Automate instance to run upon retirement.
NoteThe entry point must be a State Machine since the Provisioning Entry Point list is filtered to only show State Machine class instances. No other entry points will be available from the Provisioning Entry Point field.
- In the Details subtab, write a Long Description for the catalog item.
- Click Add.
5.3.4. Creating an Ansible Playbook Service Catalog Item
Create a catalog item that uses an Ansible Playbook to back it.
Create a catalog item that uses an Ansible Playbook to back it.
Before creating an Ansible service, at least one repository, one playbook, and one credential must exist in the Red Hat CloudForms inventory. Check your inventory and add the appropriate resources before creating an Ansible service. For more information, see Automation Management Providers in Managing Providers.
- Navigate to → .
- In the Catalog Items accordion, click on the All Catalog Items.
-
Click
(Configuration), then
(Add a New Catalog Item).
- Select Ansible Playbook from the Catalog Item Type drop-down list.
- Type a Name and Description for the new service catalog item.
- Click Display in Catalog.
- Select the appropriate Catalog from the drop-down list.
In the Provisioning tab, set parameters for your catalog item to use by configuring a Playbook to back your service item:
- Choose a Repository from the drop-down list.
- Select the Ansible Playbook to use.
- Assign the appropriate Machine Credentials from the drop-down list.
- Add Cloud or Network Credentials from the drop-down lists.
- Choose the Host against which to run the service item.
- Use the Escalate Privilege toggle switch to enable user privilege escalation if called for in credentials during the playbook run.
- Add key value pairs for Variables and their corresponding Default Values.
- In the Dialog options, choose an existing dialog from the Use Existing drop-down list or select Create New to add a new dialog.
In the Retirement tab, set parameters for your catalog item to use by selecting values for the following:
- Choose a Repository from the drop-down list.
- Select the Ansible Playbook to use.
- Assign the appropriate Machine Credentials from the drop-down list.
- Add Cloud or Network Credentials from the drop-down lists.
- Choose the Host against which to run the service item.
- Use the Escalate Privilege toggle switch to enable user privilege escalation if called for in credentials during the playbook run.
- Add key value pairs for Variables and their corresponding Default Values.
- In the Dialog options, choose an existing dialog from the Use Existing drop-down list or select Create New to add a new dialog.
- Click Add.
5.3.5. Creating an Ansible Tower Service Catalog Item
Create a service catalog item from an Ansible Tower template you can use to execute an Ansible Tower playbook in Red Hat CloudForms.
Create a service catalog item from an Ansible Tower template you can use to execute an Ansible Tower playbook in Red Hat CloudForms.
You must first create the job template in Ansible Tower. The job templates are automatically discovered by CloudForms when refreshing your Ansible Tower provider’s inventory.
First, create a catalog:
- Navigate to → .
-
Click
(Configuration), then
(Add a New Catalog)
- Enter a Name and Description for the catalog.
- Click Add.
Then, create an Ansible Tower service catalog item:
- Navigate to → → .
- Click Ansible Tower Job Templates and select an Ansible Tower job template.
-
Click
(Configuration), then
(Create Service Dialog from this Job Template).
- Enter a Service Dialog Name (for example, ansible_tower_job)and click Save.
- Navigate to → . Click Catalog Items.
Click
(Configuration), then
(Add a New Catalog Item) to create a new catalog item with the following details, at minimum:
- For Catalog Item type, select Ansible Tower.
- Enter a Name for the service catalog item.
- Select Display in Catalog.
- In Catalog, select the catalog you created previously.
- In Dialog, select the service dialog you created previously (in this example, ansible_tower_job). No Dialog can be selected if the playbook does not require extra variables from the user. To ask the user to enter extra information when running the task, Service Dialog must be selected.
- In Provider, select your Ansible Tower provider. This brings up the Ansible Tower Job Template option and configures the Provisioning Entry Point State Machine automatically.
- Add configuration information for Reconfigure Entry Point and Retirement Entry Point as applicable.
- Select your desired Ansible Tower Job Template from the list. Generally, this is the Ansible Tower job template previously used to create the service dialog.
- Click Add. The catalog item you created will appear in the All Service Catalog Items list.
5.3.5.1. Provisioning a Service
- Navigate to → .
- Click the Service Catalogs accordion, and select the service to provision.
- Click Order.
The parameters are passed to the children based on the method tied to the choices made in the dialog.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.