Chapter 3. Invoking Automate

3.1. Automate Examples

This chapter describes the ways to invoke an Automate workflow. Automation can be initiated through an alert, an event, a CloudForms Management Engine application, or a custom button. The same automation process can be re-used across more than one of these. For example, using automation to remove orphaned virtual machines and instances could be initiated by:

  • An administrator request from the CloudForms Management Engine console (from a custom button)
  • An alert indicating the datastore has less than 20% free-space
  • A virtual machine or instance unregistered event is detected

All invocations of an automate model must enter through the /System/Process namespace.

3.2. Invoking Automate using a Custom Button

One of the ways to invoke an Automate model is to map an instance from the /System/Process/Request class to a custom button. Before creating the button, you need to have an instance in the /System/Process/Request class to map to it and a button group to assign it to.

Create buttons for a cluster, host, datastore, provider, virtual machines or cloud instances. When the button is clicked, the model will be invoked for the selected item. For each of these, you can have up to 15 buttons.

3.3. Creating a Custom Button Group

This procedure shows you how to create a custom button group.

  1. Navigate to AutomateCustomization.
  2. Click the Buttons accordion.
  3. From the Object Types tree, select the type of object you want to create the button group for.
  4. Click image (Configuration), image (Add a new Button Group).
  5. Type in a Button Group Text and Button Group Hover Text, and select the Button Group Image you want to use.
  6. If custom buttons have already been created, assign them to the button group. If not, see Section 3.4, “Creating a Custom Button” to create custom buttons.
  7. Click Add.

The button group will show in the object type you added the button to.

3.4. Creating a Custom Button

This procedure shows you how to create a custom button.

  1. Navigate to AutomateCustomization.
  2. Click the Buttons accordion.
  3. From the Object Types tree, select the type of object you want to create the button for.
  4. Click Unassigned Buttons.
  5. Click image (Configuration), then image (Add a new Button).

    Note

    If image (Add a new Button) is not available, that means you have not created a button group for that object. To continue, create a button group first. See Section 3.3, “Creating a Custom Button Group”

  6. In Action, type in a Button Text and Button Hover Text, and select the Button Image you want to use.
  7. Select a Dialog if applicable.
  8. In Object Details, select Request from the /System/Process/ dropdown. By default, the message is create. Do not change it.
  9. Type in a Request name for the /System/Process/Request instance.
  10. Type in the Attribute/Value Pairs fields if applicable.
  11. Under Visibility, select which Account Roles you want to have access to this button.
  12. Click Add when you have confirmed that the button accomplishes the task you want.

The button will show in the object type you added the button to.

3.5. Editing a Custom Button

This procedure shows you how to edit a custom button.

  1. Navigate to AutomateCustomization.
  2. From the Object Types dropdown, select the type of object you want to edit the button for.
  3. Click the button you want to edit.
  4. Click image (Configuration), image (Edit this Button).
  5. Modify as required.
  6. Click Save.

3.6. Deleting a Custom Button

This procedure shows you how to delete a custom button.

  1. Navigate to AutomateCustomization, then select the Buttons accordion.
  2. From the Object Type tree in the accordion menu, select the type of object you want to remove the button from.
  3. Click image (Configuration). then click image (Remove this button).
  4. Click OK to confirm that you want to delete this button.

3.7. Using a Custom Button

This procedure shows you how to use custom buttons to invoke a cluster, host, datastore, provider, virtual machine or instance.

  1. Go to the page for the item that you created a button for.
  2. Click the custom button group from the taskbar, and then your custom button.

The automate model is invoked for the specified item.

3.8. Initiating Automate from an Event

You can also use a CloudForms Management Engine Policy Event to initiate automation. You can either use the provided Raise Automation Event action or create a custom automation action. The first case will start in the /System/Process class, but then go to the Event that initiated the Automate model in the /System/Process/Event Class. If you create your own custom action, it will start from the /System/Process class and then go to the /System/Process/Request Class instead.

For example, suppose that you always want the same Automate model to occur when a virtual machine is created. You would use the Raise Automation Event Action. There are instances in the /System/Process/Event Class for the following Events that you can select as part of a Policy:

image

3.9. Creating a Policy for Automate

This procedure shows you how to create a policy for automate.

  1. Navigate to ControlExplorer.
  2. Click the Policies accordion, and select Control Policies.
  3. Select VM Control Policies.
  4. Click image (Configuration), then image (Add a New Control Vm Policy).
  5. Type in a Description.
  6. Uncheck Active if you do not want this policy processed even when assigned to a resource.
  7. Click Add. You are brought to the page where you add conditions and events to your new policy.
  8. Click image (Configuration), then image (Edit this Policy's Event assignments).

    • Check the events you want to use to send to an Automate Model.
    • Click Save.
    • From the Events area, click on the Description of the Event you want to assign an action to.
    • Click image (Edit Actions for this Policy Event).
  9. Select Raise Automation Event, and click image (Move selected Actions into this Event).
  10. Click Save.

You can now assign this policy to a Policy Profile. Then, assign the policy profile to the virtual machines. Every time this event happens on the virtual machine the appropriate Automate Model will be initiated.

Note

If you want the policy to initiate an Automate Model from the /System/Process/Request class, then you can create your own custom action. Be sure to have an instance in the /System/Process/Request class for it to map to.

3.10. Creating a Custom Automate Action

This procedure shows you how to create a custom Automate action.

  1. Navigate to ControlExplorer accordion.
  2. Click the Actions accordion.
  3. Click image (Configuration), then image (Add a new Action).
  4. Type in a Description for the Action.
  5. Select Invoke a Custom Automation from Action Type.
  6. In Custom Automation,

    • For Message, type create.
    • For Request, type in the name of the instance of the /System/Process/Request Class in the second.
  7. Type in the Attribute/Value Pairs fields if applicable.
  8. Click Add.

The action is created and can be added to a policy.