Chapter 3. Conditions

Conditions are tests performed on attributes of virtual machines. A condition can contain two elements, a scope, and an expression. The expression is mandatory, but the scope is optional. A scope is a general attribute that is quickly checked before evaluating a more complex expression. For example, you might use a scope to check the operating system, and use an expression to check for a specific set of applications or security patches that only apply to the operating system referenced in the scope. If no conditions, scope or expression, are defined for a policy, the policy is considered unconditional and returns a true value.

3.1. Creating a Condition

You can create a condition either from within a policy screen or by going directly to the expression editor in the CloudForms Management Engine console. You need to define a description and an expression element. The expression element defines what criteria you want to use to test the condition.

  1. Navigate to ControlExplorer.
  2. Click the Conditions accordion, and select either Host Conditions or VM Conditions.
  3. Click image (Configuration), then image (Add a New Host Condition) or image (Add a New VM Condition).
  4. Enter a Description for the condition.

    image

  5. Click image (Edit this Scope) in the Scope area to create a general condition based on a simple attribute. Based on what you choose, different options appear. Creating a scope is optional.

    image

    • Click Field to create criteria based on field values.

      image

    • Click Count of to create criteria based on the count of something, such as the number of network adapters on the host.

      image

    • Click Tag to create criteria based on tags assigned to your resources. For example, you can check the power state of a virtual machine or see if it is tagged as production.

      image

    • Click Find to seek a particular value, and then check a property. For example, finding the Admin account and checking that it is enabled. Use the following check commands:

      • Check Any: The result is true if one or more of the find results satisfy the check condition.
      • Check All: All of the find results must match for a true result.
      • Check Count: If the result satisfies the expression in check count, the result is true.

        image

    • Click Registry to create criteria based on registry values. For example, you can check if DCOM is enabled on a Windows System. Note that this applies only to Windows operating systems. Registry will only be available if you are creating a VM Condition.

      image

  6. Click image (Commit expression element changes) to add the scope.
  7. Click image (Edit this Expression) in the Expression area to create a general condition based on a simple attribute. Based on what you choose, different options appear.

    • Click Field to create criteria based on field values.

      image

    • Click Count of to create criteria based on the count of something, such as the number of snapshots for a virtual machine, or the number of virtual machines on a host.

      image

    • Click Tag to create criteria based on tags assigned to your resources. For example, you can check the power state of a virtual machine or see if it is tagged as production.

      image

    • Click Find to seek a particular value, and then check a property. For example, finding the Admin account and checking that it is enabled. Use the following check commands.

      • Check Any: The result is true if one or more of the find results satisfy the check condition.
      • Check All: All of the find results must match for a true result.
      • Check Count: If the result satisfies the expression in check count, the result is true.

        image

    • Click Registry to create criteria based on registry values. For example, you can check if DCOM is enabled on a Windows System. Note that this applies only to Windows operating systems.

      image

  8. Click image (Commit expression element changes) to add the expression.
  9. In Notes, type in a detailed explanation of the condition.
  10. Click Add.

3.2. Editing a Condition

Edit a condition to add more expressions to it or modify its properties. You can edit conditions that you have created.

  1. Navigate to ControlExplorer.
  2. Click the Conditions accordion, and click on the condition you want to edit.
  3. Click image (Configuration), image (Edit this Condition).
  4. Click in either the Scope or Expression area, and click the part of the condition to edit.

    image

  5. Make any edits for the current expression.

    • Click image (Commit expression element changes) to add the changes.
    • Click image (Undo the previous change) to cancel the last action executed.
    • Click image (Redo the previous change) to repeat the previous action executed.
    • Click image (AND with a new expression element) to create a logical AND with a new expression element.
    • Click image (OR with a new expression element) to create a logical OR with a new expression element.
    • Click image (Wrap this expression element with a NOT) to create a logical NOT on an expression element
    • Click image (Remove this expression element) to take out the current expression element.
  6. When you have made all of the changes to the condition, click Save.

3.3. Copying a Condition

You can copy a condition to create a similar condition, then change the values associated with it. You can copy the sample conditions provided to customize them to your environment.

  1. Navigate to ControlExplorer.
  2. Click the Conditions accordion, and select the condition you want to copy.
  3. Click image (Configuration), image (Copy this Condition to a new Condition).
  4. Make any changes you need for the new condition. The description must be unique to all conditions.
  5. Click Add.

3.4. Deleting a Condition

Remove conditions that are no longer applicable. You can only delete conditions that are not part of a policy. To be able to delete the condition, you must remove the policy first.

  1. Navigate to ControlExplorer.
  2. Click the Conditions accordion, and click on the condition you want to remove.
  3. Click image (Configuration), image (Delete this VM and Instance Condition).
  4. Click OK to confirm.