Chapter 8. Automate Model
Chapter 8. Automate Model
8.1. About Automate
This chapter discusses the Automate feature set. ManageIQ Management Engine Automate enables realtime, bi-directional process integration and adaptive automation for management events and administrative or operational activities.
8.2. Automate Model
The Automate model is designed to be used by operations administrators, platform and subsystem support administrators, and line of business or application owners. With that in mind, the Automate model is comprised of the following namespaces.
Alert is used to send emails for different automation tasks.
Automation is used specifically for management activities for hosts, storage, virtual machines and cloud instances, including both lifecycle and operations.
ManageIQ Management Engine Applications includes automation activities specifically used with
ManageIQ Management Engine. For example, the ability to provision virtual machines and cloud instances with customizations.
Factory includes methods created by Red Hat that can be reused by creating relationships. For example, it includes the methods for sending emails, logging events, and performing a SmartState analysis.
Integration is used to interface with systems outside of ManageIQ Management Engine such as
Configuration Management Database (CMDB), Simple Network Management
Protocol (SNMP), and IP Address Management (IPAM). Use this namespace if you want to integrate with additional systems.
Sample provides examples of methods that can be tailored for your own environment.
System contains classes that can provide the start points for all ManageIQ Management Engine
Automate activities.
Each namespace can contain another namespace or classes. A class has a schema and includes attributes, methods, and relationships. An instance can include a collection of any number of attributes, methods, and relationships. For example, an instance can be a collection of attributes and a relationship or just one method.
Note
Red Hat does not recommend changing any of the existing classes or instances shipped with the product as this may hinder the operation of the ManageIQ Management Engine. However, you can link to these methods using relationships.
8.3. Creating a Class
Procedure 8.1. To Create a Class
73
ManageIQ 6.0 Management Engine 5.2 Lifecycle and Automation Guide
1. Navigate to Automate → Explorer, navigate to the namespace you want to add a class to.
2. Click (Configuration), then (Add a new Class).
3. Type in a unique Name and Description.
4. 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.
5. Click Add.
Result:
The new class is created and you can create a schema, add instances and methods.
Note
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.
8.4. Creating a Schema for a Class
This procedure shows you how to create a schema.
Procedure 8.2. To Create a Schema for a Class
1. Navigate to Automate → Explorer, and click the class you want to define a schema for.
2. Click on the
Schema tab.
3. Click
(Configuration), then (Edit selected Schema).
4. Click (Click to add a new field) to create a new field.
5. Type in a Name for the new field.
6. From Type, select Assertion, Attribute, Method, Relationship, or State.
7. If applicable, select a Data Type and set a Default Value.
8. Type in a user friendly Display Name and Description.
9. Check Sub to enable the substitution syntax of ${}. Uncheck it if you want to use that syntax as a regular string.
10. Fill in
Collect and Message as required. Collect is used to rollup 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.
11.
On Entry, On Exit, On Error, Max Retries, and Max Time are fields used mostly for state machines. Leave blank if not applicable. See State Machines.
74
Chapter 8. Automate Model
12. Click
(Add this entry) to confirm the fields values.
13. For each new field, repeat steps 4 through 10.
14. When you have created all of the fields, click Save.
Result:
The class schema is created, and you can now add instances to it.
Note
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.
8.5. Editing a Field in a Schema
This procedure shows you how to edit schema fields.
Procedure 8.3. To Edit a Field in a Schema
1. Navigate to Automate → Explorer.
2. Click the class you want to define a schema for.
3. Click the
Schema tab.
4. Click
(Configuration), then (Edit selected Schema).
5. Make required changes to any of the definitions for the field.
6. To remove a field, click (Click to delete this field from the schema).
7. Click Save when you are finished editing the schema.
Result:
Once the schema is created, you can add instances and methods to the class.
8.6. Editing Schema Sequence
This procedure shows you how to change schema sequence.
Procedure 8.4. To Edit a Schema Sequence
1. Navigate to Automate → Explorer.
2. Click the class you want to change the schema sequence for.
3. Click the Schema tab.
75
ManageIQ 6.0 Management Engine 5.2 Lifecycle and Automation Guide
4. Click (Configuration), then (Edit Sequence).
5. 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
up).
(Move selected field
To move a field down in the order of resolving an instance, click
field down).
6. Click Save when you are finished editing the sequence.
8.7. Adding an Instance to a Class
This procedure shows you how to create an instance.
(Move selected
Procedure 8.5. To Add an Instance to a Class
1. Navigate to Automate → Explorer.
2. Click the class you want to define a schema for.
3. Click the Instances tab.
4. Click (Configuration), then (Add a new Instance).
5. In the Main Info area, type in a Name, Display Name and Description.
6. 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.
7. Click
Add.
8.8. Relationships
8.8.1. Relationship Syntax
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.
8.8.2. Table: Relationship Examples
Example
/Integration/IPAM/AcquireMACAddress#${#ae_me ssage}
Explanation
Goes to Integration Namespace, IPAM Class, substituting the value of ae_message for the
76
ssage}
/FACTORY/METHOD/vm_allowed?
vm_id=${process#vm_id}
/Factory/Method/VM_SCAN?
vm_id=${process#vm_id}
Chapter 8. Automate Model substituting the value of ae_message for the message.
Goes to Factory Namespace, Method class, vm_allowed method, passing the vm_id that came in through the process class (The VM from where the Automation Model was initiated).
Goes to Factory Namespace, Method class, vm_scan (SmartState Analysis) method, passing the vm_id that came in through the process class
(The VM from where the Automation Model was initiated).
8.9. Methods
8.9.1. Methods
Methods are pieces of code associated with a class or object to perform a task. ManageIQ Management
Engine allows for Perl or Ruby methods. You can create your own methods or use relationships to link to pre-existing ones. In addition, you can use Windows PowerShell to create these methods. If you will be using PowerShell, you must install a SmartProxy on a Windows computer with network access to a
ManageIQ Management Engine Appliance in the ManageIQ Management Engine Zone where you are running Automation.
8.9.2. Installing a Windows SmartProxy for PowerShell
This procedure shows you how to install a Windows SmartProxy for PowerShell. On the computer where you want to run the Windows SmartProxy, log in to the ManageIQ Management Engine Console.
Procedure 8.6. To Install a Windows SmartProxy for PowerShell
1. Click Configure → Configuration.
2. Click the Settings accordion, and click Zones.
3. Click the zone where the ManageIQ Management Engine server is located.
4. Click on the ManageIQ Management Engine server that you want to apply the maintenance to.
5. Click the Maintenance tab.
6. Click on the Product Update with a component of SmartProxy and platform of Windows.
7. Click
Download. The file is downloaded to the computer where you are accessing the ManageIQ
Management Engine Console.
8. Open a command prompt, and navigate to the directory where you downloaded the file.
9. Run:
C:\Downloads\>filename -h ipaddress install
77
ManageIQ 6.0 Management Engine 5.2 Lifecycle and Automation Guide
Note
Ensure that
filename is replaced with the actual name of the file downloaded, and that
ipaddress is replaced with the IP address of your ManageIQ Management Engine host.
Result:
The SmartProxy is installed as a service onto the Windows computer in the
/Program Files/Red Hat
directory. To start up the Windows SmartProxy, go to
Services in the Control Panel,
Administrative Tools. Start the Red Hat SmartProxy Service. The service is set to automatically start when you restart the computer.
8.9.3. Creating a Method
This procedure shows you how to create a method.
Procedure 8.7. To Create a Method
1. Navigate to
Automate → Explorer, navigate to the class where you want to create a method.
2. Click the
Methods tab.
3. Click
(Configuration), (Add a New Method).
4. In the Main Info area, type in a Name and Display Name.
5. For Location, select inline. Once selected, you will be presented with a Data area in which to write or copy the script.
6. Click Validate to check the syntax.
7. Click Add.
Result:
The
Factory Namespace provides methods that can be re-used throughout the automation model.
You can link to these in an instance by using a relationship instead of writing your own scripts.
8.10. Simulation
8.10.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.
8.10.2. Simulating an Automate Model
This procedure shows you how to simulate an automate model.
Procedure 8.8. To Simulate an Automate Model
78
Chapter 8. Automate Model
1. Navigate to Automate → Simulation.
2. In Object Details, select a type of object from /System/Process/ that will initiate the model.
The
Message should be create. Type in the name of the Request where you are starting from.
3. Select the Type of item you want to run the simulation on. Then, select a specific one to use as the example.
4. Check
Execute Methods if you want to perform the model and not just simulate it.
5. Type in the
Attribute/Value Pairs fields if applicable.
6. Click
Submit.
Result:
Click on the Tree View or XML View tabs to see results.
8.11. Importing, Exporting, and Resetting the Datastore
8.11.1. Importing, Exporting, and Resetting the Datastore
The
Automate Model can be exported and imported as an XML file. ManageIQ Management Engine 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.
79
ManageIQ 6.0 Management Engine 5.2 Lifecycle and Automation Guide
8.11.2. Exporting All Datastore Classes
This procedure shows you how export datastore classes as an XML file.
Procedure 8.9. To Export All Datastore Classes
1. Navigate to
Automate → Import/Export.
2. Click
(Export all Datastore classes and instances to a file).
3. Follow your browsers prompts to save the file.
Result:
The datastore is exported as an XML file.
8.11.3. Importing Datastore Classes
This procedure shows you how to import datastore classes.
Procedure 8.10. To Import Datastore Classes
1. Navigate to Automate → Import/Export.
2. Export the datastore so that you have a backup.
3. Click
Browse to navigate to the location of the file to import.
4. Click
Upload.
Result:
The datastore is imported from the XML file.
8.11.4. Resetting Datastore to Default
This procedure shows you how reset datastore to default.
Procedure 8.11. To Reset the Datastore to the Default
1. Navigate to Automate → Import/Export.
2. Export the datastore so that you have a backup.
3. Click
(Reset all Datastore custom classes and instances to default).
4. Read the prompt warning you that communication with the datastore will be lost and all classes and instances will be cleared and reset.
5. After reading the prompt, click OK.
80