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. 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.6. 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.7. 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.8. 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 guide.
-
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.9. 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.10. 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.11. 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.12. 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.13. 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.14. Methods
Methods are pieces of code associated with a class or object to perform a task. Red Hat CloudForms allows for Ruby methods. 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.14.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.14.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. Simulation
1.15.1. 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.15.2. 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.16. Importing, Exporting, and Resetting the Datastore
1.16.1. 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.
1.16.2. 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 browsers prompts to save the file.
The datastore is exported as a YAML file.
1.16.3. 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.16.4. 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.