Chapter 1. Understanding the Automate Model
Automate enables real-time, bi-directional process integration. This provides users with a method to implement adaptive automation for management events and administrative or operational activities.
1.1. Automate Model
The Automate model is arranged to provide an object oriented hierarchy to control automation functions. The model uses the following organizational units arranged in a hierarchy:
- Datastore - The main organization unit that stores the entire model.
- Domains - Domains act as collection of automation functions. Functions are executed depending on the order of Domain priority, which means a function in a Domain with a higher priority overrides the same functions specified in a lower-priority Domain. This allows Red Hat CloudForms to specify a core Domain (ManageIQ) but allow users to override automate functions with custom Domains. Each Domain contains a set of Namespaces.
- Namespaces - Containers that organize and categorize functions of the model. Namespaces can contain child Namespaces as well as Classes.
- Classes - Templates for a specific function of the model. Each Class uses a Schema to apply to Instances to populate with default values. Each class also can contain a set of methods.
- Instances - An instance is a version of a class populated with initial configuration data. An instance can include a collection of any number of attributes, calls to methods, and relationships.
- Methods - Methods are functions within the model. Methods use Ruby code to execute various operations needed for a Class.
Red Hat CloudForms contains a set of preconfigured Domains for users:
ManageIQ - The core domain for Red Hat CloudForms Automate operations. This domain is locked with the following Namespaces:
- Cloud - General cloud instance lifecycle from provisioning, retirement, methods, email.
- Control - Control contains email alerts for policy controls.
- Infrastructure - General infrastructure VM lifecycle from provisioning, retirement, methods, email.
- Service - Service lifecycle from provisioning, retirement, methods, email.
- System - System contains classes that can provide the start points for all Red Hat CloudForms Automate activities.
RedHat - Domain containing advanced operations, specifically interactions with supported cloud and infrastructure providers. This domain is locked with the following Namespaces:
- Cloud - Red Hat-supported cloud instance lifecycle from provisioning, retirement, methods, email.
- Infrastructure - Red Hat-supported cloud instance lifecycle from provisioning, retirement, methods, email.
- Integration - Used to interface with systems outside of Red Hat CloudForms. Use this namespace to integrate with additional systems.
You can copy classes and instances from locked Domains into your own custom domains.
Changing the existing classes or instances shipped with the product is not recommended because this may hinder the operation of Red Hat CloudForms. You can link to these methods using relationships.
To reset the Automate model to default settings, navigate to → and click the Reset option.
1.2. Creating a Domain
- Navigate to → → . The default view is the Datastore.
-
Click
(Configuration), then
(Add a New Domain).
- Type in a unique Name and Description. Choose if the Domain is Enabled.
- Click Add.
The new domain is created.
1.3. Editing a Domain
- Navigate to → → . The default view is the Datastore.
- Select the Domain you want to edit.
-
Click
(Configuration), then
(Edit Selected Domain).
- Make the required edits.
- Click Save.
You have edited the selected domain.
1.4. Deleting a Domain
- Navigate to → → . The default view is the Datastore.
- Select the Domain that you want to delete.
-
Click
(Configuration), then
(Remove This Domain).
- A window to confirm the removal of Domain appears.
- Click OK.
The selected Domain is deleted.
1.5. Importing a Domain
Red Hat CloudForms adds the ability to import an Automate domain from a Git repository by specifying a repository and branch, along with user details. Currently, you can only add git domains via the Import/Export option of the user interace.
- Navigate to → → .
- In Import Datastore via git, enter the Git URL. Select the branch or tag to use.
- Optionally, enter a Username and Password.
- Click Submit.
The new domain is imported via Git repository. Note that the domain is validated on import.
1.6. Changing Priority Order of Domains
Functions are executed depending on the order of Domain priority. Use this procedure to change the priority order of domains.
- Navigate to → → . The default view is the Datastore.
- Select the Domains you want to change the priority order for.
-
Click
(Configuration), then
(Edit Priority Order of Domains).
- The list of Domains selected shows up. Note that you cannot change the priority of locked Domains and therefore locked Domains do not show up on the list.
- Select one or more consecutive groups to move up or down to change their priority as required.
- Click Save.
1.7. Creating a Namespace
- Navigate to → → . The default view is the Datastore.
- Navigate through the various Domains and Namespaces until you reach the desired location for your new Namespace.
-
Click
(Configuration), then
(Add a New Namespace).
- Type in a unique Name and Description.
- Click Add.
The new Namespace is created.
1.8. Creating a Class
- Navigate to → → , navigate to the namespace you want to add a class to.
-
Click
(Configuration), then
(Add a new Class).
- Type in a unique Name and Description.
- If you want to use the schema from a class that has already been created, select it from the Inherits From dropdown. If the class that the new class inherits from changes, the new class will also change.
- Click Add.
The new class is created and you can create a schema, add instances and methods.
For each class, create a schema if you did not choose to inherit from an existing class. The schema can include attributes, methods, assertions, and relationships.
1.9. Creating a Schema for a Class
This procedure shows you how to create a schema.
- Navigate to → → , and click the class you want to define a schema for.
- Click on the Schema tab.
-
Click
(Configuration), then
(Edit selected Schema).
-
Click
(Click to add a new field) to create a new field.
- Type in a Name for the new field.
- From Type, select Assertion, Attribute, Method, Relationship, or State.
- If applicable, select a Data Type and set a Default Value.
- Type in a user friendly Display Name and Description.
-
Check Sub to enable the substitution syntax of
${}. Uncheck it if you want to use that syntax as a regular string. - Fill in Collect and Message as required. Collect is used to roll up values from resolved relationships. For example, a relationship can resolve to a large object tree. Use collect to specify how to pull out data from those child objects into the current object. If you give collect a name value, it will store the method result in an attribute of the current object with that name.
- On Entry, On Exit, On Error, Max Retries, and Max Time are fields used mostly for state machines. Leave blank if not applicable. For more information, see Provisioning Virtual Machines and Hosts.
-
Click
(Add this entry) to confirm the fields values.
- For each new field, repeat steps 4 through 10.
- When you have created all of the fields, click Save.
The class schema is created, and you can now add instances to it.
You may need to edit a class schema to reorder, add, edit, or remove a field. Classes define the order in which fields are processed and you may need to process some items before others.
1.10. Editing a Field in a Schema
This procedure describes how to edit schema fields.
- Navigate to → → .
- Click the class you want to define a schema for.
- Click the Schema tab.
-
Click
(Configuration), then
(Edit selected Schema).
- Make required changes to any of the definitions for the field.
-
To remove a field, click
(Click to delete this field from the schema).
- Click Save when you are finished editing the schema.
Once the schema is created, you can add instances and methods to the class.
1.11. Editing Schema Sequence
This procedure shows you how to change schema sequence.
- Navigate to → → .
- Click the class you want to change the schema sequence for.
- Click the Schema tab.
-
Click
(Configuration), then
(Edit Sequence).
In the Class Schema Sequencing area, click the field you want to change the sequence for.
-
To move a field up in the order of resolving an instance, click
(Move selected field up).
-
To move a field down in the order of resolving an instance, click
(Move selected field down).
-
To move a field up in the order of resolving an instance, click
- Click Save when you are finished editing the sequence.
1.12. Adding an Instance to a Class
This procedure shows you how to create an instance.
- Navigate to → → .
- Click the class you want to define a schema for.
- Click the Instances tab.
-
Click
(Configuration), then
(Add a new Instance).
- In the Main Info area, type in a Name, Display Name and Description.
- In the Fields area, type in an appropriate value for each field, leave the field blank if no value is required, or use the default value.
- Click Add.
1.13. Copying a Class or Instance
- Navigate to → → . The default view is the Datastore.
- Navigate through the various Domains and Namespaces until you reach the desired class or instance to copy.
-
Click
(Configuration), then either (Copy this Class) or (Copy this Instance) depending on the object chosen.
- Choose the target Domain in the To Domain drop-down menu.
- The object retains the same path as the From Domain and overrides the class in From Domain if the To Domain has a high priority. You can also untick the Copy to same path option to specify a new Namespace.
- Click Add.
1.14. Relationships
Relationships are used to connect to other instances in the Automation Datastore. Relationships are formed using URI syntax. The following can also be passed through a relationship:
-
Use
#to set the message to send to the item in the relationship. -
To pass an input to the method use
?followed by the item to pass. -
If you want to use a substitution, the syntax is
$\{}with the substitution located between the brackets.
| Example | Explanation |
|---|---|
|
|
This relationships uses the Default instance of the Naming class, which provides a means for other classes to name virtual machines. The relationship sends the |
|
|
This relationships substitutes the message to send to the AcquireMACAddress instance of the VMProvision_VM class with the value in |
|
|
Invokes the vm_retirement_emails instance of the Email class. Also sends the value |
|
|
Invokes the Retirement instance of the Lifecycle class and send a replacement value in |
1.15. Methods
Methods are pieces of code associated with a class or object to perform a task. Red Hat CloudForms allows for Ruby methods or backing a method using an Ansible playbook. You can create your own methods or use relationships to link to pre-existing ones.
Red Hat CloudForms ships with a core set of Ruby gems used by the Red Hat CloudForms Rails Application. The Ruby gems in this set are subject to change. If you are calling gems using Automate that are no longer in this release, you can install them by using the gem install command.
While gems can be imported into automation methods using require, it is recommended that the authors of the automation methods clearly document the use of gems either in the core set or a custom set. It is the responsibility of the author of such custom automation to own the life cycle of any gem being referenced in those methods.
The Release Notes list Ruby gems that have been added, updated, or removed in the latest version of Red Hat CloudForms.
For lists of Ruby gems included in different Red Hat CloudForms releases, see:
1.15.1. Creating a Method
This procedure shows you how to create a method.
- Navigate to → → , navigate to the class where you want to create a method.
- Click the Methods tab.
-
Click
(Configuration),
(Add a New Method).
- In the Main Info area, type in a Name and Display Name.
- For Location, select inline. Once selected, you will be presented with a Data area in which to write or copy the script.
- Click Validate to check the syntax.
- Click Add.
1.15.2. Creating a Dynamic Content Dialog
The procedure describes the steps to create a dynamic content dialog.
- Navigate to → → .
From the accordion menu, click → → → → .
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.
This example uses the Cloud Namespace but can also use the Infrastructure namespace.
-
Click
(Configuration), then
(Add a new Instance).
-
In the Main Info area, enter Name =
dynamic_list, replacingdynamic_listwith an appropriate name for the method. - Enter a Display Name and Description.
-
In the Fields area, enter Value =
dynamic_list. Leave the other fields blank or use the default values. - Click Add.
- Navigate to Methods tab.
- In the Main Info area, enter Name = \\dynamic_list and populate the Data section with the example automate method below.
- Click Add.
Set the automate entry point for the dialog control; use the new instance created in step four. You can create a new domain and copy the method to that domain.
# Automate Method dialog_field = $evm.object # sort_by: value / description / none dialog_field["sort_by"] = "value" # sort_order: ascending / descending #dialog_field["sort_order"] = "ascending" # data_type: string / integer dialog_field["data_type"] = "integer" # required: true / false # dialog_field["required"] = "true" dialog_field["values"] = {1 => "one", 2 => "two", 10 => "ten", 50 => "fifty"} dialog_field["default_value"] = 2
1.15.3. Creating a Playbook Automate Method
Red Hat CloudForms can choose an Ansible playbook from a repository and execute it as a method. Each playbook method can take additional input parameters specified by the user.
- You must first sync your playbook repositories before using them to create a method. See Adding a Playbook Repository in Managing Providers for information on initial playbook repository set-up.
- Using Ansible playbooks to populate dynamic dialog fields is not recommended due to delay times caused by the overhead of interaction between systems.
- Only users with administrator privileges can run a service dialog based on a playbook automate method.
To create a playbook automate method:
- Navigate to → → , then click on a domain under Datastore.
- Under a namespace, select the class for which you want to create a new method.
- Click the Methods tab.
-
Click
(Configuration) then,
(Add a New Method).
- In the Main Info area, select playbook from the drop-down menu.
- Provide a Name and Display Name.
Select a playbook Repository from the list.
- Choose a Playbook to use.
- Select the Machine Credential the playbook will use when it runs.
- From the Cloud Type list, select a cloud provider.
- Choose the Cloud Credential that corresponds to the selected cloud type.
- Specify the Hosts on which the playbook will run. Choose Localhost or provide unique values in the Specify host values field.
- Set the Max TTL in minutes. The Time To Live (TTL) field allows you to set the maximum execution time for the playbook to run.
- Select when to receive Logging Output from the options in the drop-down menu.
- Use the Escalate Privilege toggle switch to enable user privilege escalation if credentials are called for during the playbook run.
- Choose a Verbosity value to set the debug level for playbook execution.
Add required Input Parameters using the fields and values available. Click the
to add additional input parameters.
NoteInput parameters become extra vars, with substitution enabled. This overcomes the lack of a dialog which would normally allow for the input of additional information. For more information on extra vars, see the Ansible documentation.
- Click Add when finished.
1.16. Expression Methods
CloudForms additionally provides support for Expression Methods, that allow you to use advance search filters as Automate Methods, substituting the user input from Automate Objects. Expression methods have several distinct advantages, including: running directly in the worker appliance; removing the overhead of forking a DRb process to run the Automate Methods; no Ruby code required; and prebuilt for Dynamic Dialogs.
1.16.1. Input Parameters
Expression methods allow for substitution of user input through input parameters,
| Input Parameter | Explanation |
|---|---|
| arg | The argument used in the expression. Each argument should employ the prefix arg. Example: arg1: the first argument in the expression; arg2: the second argument in the expression; argn: the nth argument in the expression. |
1.16.1.1. Optional Input Parameters
If attributes and distinct are not specified we try to store the result in a variable called values with a hash consisting of id and name. This makes it compatible with our existing dynamic dialog result set.
| Optional Input Parameter | Explanation |
|---|---|
| attributes | A comma delimited list of attributes to select from the resultant objects. This should me marked as an Array Type in the Input Parameters field. |
| distinct | A comma delimited list of attributes which are distinct in the resultant objects.This should me marked as an Array Type in the Input Parameters field. |
| result_obj | The object where the result data should be stored. (default: current object) |
| result_attr | The name of the attribute which stores the result. (default: values) |
| result_type | The result type hash or array (default: dialog_hash which matches to our dynamic dialog hash. Valid values are hash, dialog_hash, array, simple |
| on_empty | The method behavior when the search returns an empty list. |
| error | Abort. (default: error) |
| default | The default value in case the result is empty and you select warn. |
1.16.2. Creating an Expression Method
Expression methods allow you to use advance search filters as automate methods, substituting user input at runtime, and making them ideal for dynamic dialogs.
To create an expression method:
- Navigate to → → , then click on a domain under Datastore.
- Under a namespace, select the class for which you want to create a new method.
- Click the Methods tab.
-
Click
(Configuration) then,
(Add a New Method).
- In the Main Info area, select expression from the drop-down menu.
- Provide a Name and Display Name.
- Select an Expression Object from the drop-down menu.
In the Expression editor, create the expression by setting the controls and values used at runtime:
- Using the drop-down menu, select the value to use. Based on your selection, choose or input additional values from the drop-down menus or text fields that appear.
- In the Contains field, input a value or click User will input the value.
-
Click
to complete the expression.
Add Input Parameters for each of the user input fields required.
-
Click
to add a new parameter.
- Provide a Name, Default Value and select a Data Type for each parameter.
Click
to add the parameter.
NoteIf User will input the value is checked, arguments for each input parameter names using the prefix “arg”.
For example, if there are 3 fields then the input parameter names should be arg1, arg2, and arg3. If there are two runtime parameters arg1 and arg2 must be defined in the input parameters. In the default value for these fields values can be substituted from other objects in the Automate Workspace.
-
Click
- Click Add.
1.17. Simulation
After your model is designed, use the simulate page to test it. It allows you to see the results in tree and XML view.
1.17.1. Simulating an Automate Model
This procedure shows you how to simulate an automate model.
- Navigate to → → .
In Object Details, select a type of object from
/System/Process/that will initiate the model. The Message should becreate. Type in the name of the Request where you are starting from.
Select the Type of item you want to run the simulation on. Then, select a specific one to use as the example.
Check Execute Methods if you want to perform the model and not just simulate it.
- Type in the Attribute/Value Pairs fields if applicable.
- Click Submit.
Click on the Tree View or XML View tabs to see results.
1.18. Importing, Exporting, and Resetting the Datastore
The Automate Model can be exported and imported as a YAML file. Red Hat CloudForms allows you to back up your model by export. Red Hat may provide you with new or updated classes, and provides an import function for either a class or the entire model. Finally, you can reset the datastore to its default. Always be sure to export the current datastore before importing or resetting.
The datastores you are exporting or importing between must use the same CloudForms version.
1.18.1. Exporting All Datastore Classes
This procedure shows you how export datastore classes as an XML file.
- Navigate to → → .
-
Click
(Export all Datastore classes and instances to a file).
- Follow your browser’s prompts to save the file.
The datastore is exported as a YAML file.
1.18.2. Importing Datastore Classes
This procedure shows you how to import datastore classes.
- Navigate to → → .
- Export the datastore so that you have a backup.
- Click Browse to navigate to the location of the file to import.
- Click Upload.
The datastore is imported from the YAML file.
1.18.3. Resetting Datastore to Default
This procedure shows you how reset datastore to default.
- Navigate to → → .
- Export the datastore so that you have a backup.
-
Click
(Reset all Datastore custom classes and instances to default).
- Read the prompt warning you that communication with the datastore will be lost and all classes and instances will be cleared and reset.
- After reading the prompt, click OK.

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.