Creating Workflows

This chapter contains the following sections:

Viewing the Task Library

Cisco UCS Director contains web-based documentation on all predefined tasks. To view the documentation, do the following:


    Step 1   On the menu bar, choose Policies > Orchestration.
    Step 2   Click the Task Library action.
    Step 3   Check the Regenerate document check box to include new tasks and tasks created using Cisco UCS DirectorOpen Automation.
    Step 4   Click Submit. The Orchestration Task Library appears in your default web browser.
    Note   

    There are several hundred entries. You can use your browser's search function to find a particular task.

    Step 5   Click an entry to see detailed information about a task.

    Creating a Workflow

    Creating a workflow can be broken down into five overall steps:

    1. Define the workflow. To define a workflow, you name the workflow and select a few other details.

    2. Define the workflow inputs and outputs. You specify which input parameters the workflow requires to execute, and what output results from its execution.

    3. Once the workflow inputs and outputs are defined, use the Workflow Designer to add a workflow task to the workflow.

    4. Still in the Workflow Designer, connect the task into the workflow. Repeat these two steps, defining and adding a task, until you have incorporated all the tasks needed for the workflow to carry out its function.

    5. Validate the workflow. Validating a workflow ensures that there are no errors in connecting task inputs and outputs.

    These five steps are described in the following sections.

    Defining a Workflow

    To define a workflow, do the following:


      Step 1   Navigate to Policies > Orchestration.
      Step 2   Click the Workflows tab.
      Step 3   Click the Add action.
      Step 4   In the Add Workflow Details screen, complete the following fields:
      Name Description

      Workflow Name field

      The workflow name.
      Note   

      Workflow names cannot contain the following characters: \"%&'*+,./:;<=>?^|

      Version label (not editable)

      Displays which version of the workflow you are creating or editing.

      Description field

      A description of the workflow. (Optional.)

      Workflow Context drop-down list

      The workflow context. Cisco UCS Director Orchestrator supports the following options:

      • Any—Enables you to use the workflow in any context.

      • Selected VM—Enables you to execute the workflow only when you choose a VM.

      Save as Compound Task check box

      Define the workflow as a compound task. See Creating a Compound Task.

      Publish Task outputs as Compound Task outputscheck box

      This check box appears if you choose the Save as Compound Task check box.

      Check this check box to expose all the task outputs as outputs of the compound task. Leaving the box unchecked suppresses the outputs of the included tasks so that the compound task exposes only the workflow outputs.

      Always execute during System initialization check box

      Check this check box to execute the workflow as part of the startup sequence when Cisco UCS Director is initialized.

      Note   

      Because the workflow is executed before the Cisco UCS Director GUI starts, workflows that require user input cannot be executed at system startup.

      Place in New Folder check box

      Create a new folder in which to place the workflow. If you check this check box, the Select Folder drop-down list becomes a text field. Type the name of the new folder.

      Select Folder drop-down list

      The folder in which to place the workflow.

      Notify status of execution to initiating user check box

      Email the result status to the user who invoked the workflow. If checked, you can notify more users by entering their email addresses in the Additional User(s) to send Email Notification field.

      The result status for the workflow can be one of the following:
      • Completed status

      • Failed execution status

      • Cancelled execution status

      Leave the check box unchecked to use an email policy.

      Email policy drop-down list

      Instead of specifying email recipients individually, you can use an orchestration notification email policy. Default policies exist to notify:

      • The user that starts execution of the workflow

      • The user and the user's group

      • The user's group and that group's administrator

      You can define your own policies as well by navigating to Administration > System > Orchestration Policy and selecting Add. Policies you create are available in the Email policy drop-down list.


      What to Do Next

      Click Next to define input and output for the workflow.

      Defining Workflow Input and Output

      You can define a set of inputs for a workflow. You can assign values for these inputs or restrict the values available to users at runtime. You can also choose whether to allow the user to change the administrator values at runtime.

      To define workflow inputs and outputs, complete the following steps.

      Before You Begin

      Define the workflow in the Workflow Add Details screen as described in the previous topic.


        Step 1   You can define any number of inputs for a workflow.

        Rather than define inputs for a workflow, you can instead associate the workflow with an activity and use the activity's inputs as the workflow's inputs; see Activities.

        • To associate the workflow with an activity:

          1. Check the Associate to Activity check box.

          2. In the Activity drop-down list, choose the activity with which to associate the workflow. The activity's inputs populate the input list.

          3. Skip the rest of this step.

        • To define inputs for the workflow without an activity, continue with this step:

        1. In the Workflow User Inputs screen, click the + icon at the top of the list of values.
        2. In the Add Entry To dialog box, complete the following fields:
          Name Description

          Input Label field

          The name or label of the input parameter.

          Input Description field

          A description of the input parameter.

          Optional check box

          Make the input parameter optional (not mandatory) at the time of workflow execution.

          Input Type button

          Click this button to choose the data type of the input parameter.

          Note   

          Reduce the number of input types by typing a match string in the filter field at the top of the list.

          Note   

          If you later edit a workflow, the Input Type field is not editable.

          Multiline/Multiple Value Input check box

          The effect of this option depends on the input type.

          This option is available only for the Generic Text input type. Check the box to allow the user or administrator to enter multiple lines for the input value.

          Note   

          You cannot map a multiline workflow input to a single-line task input. When creating or editing a task, no multiline workflow inputs appear in the User Input drop-down list on the User Input Mapping page.

          Input Field Size drop-down list

          This list appears if you choose the Multiline Input check box. Choose a size for the text area that is displayed to enter the input value.

          Value Restrictions heading

          Depending on the input type that you have chosen, one or more of the following are available:

          • Admin Inputcheck box—Check this box to populate inputs with default values. User input is then optional at run time.

          • Admin Input Filter—Check this box to define a rule-based filter to restrict available input values. User input is required at run time from the restricted range of values. See Admin Input Filters.

          • Admin Input List—Check this box to define an item-by-item list of available input values. User input is required at run time from the admin-selected list of values.

          Admin Input field

          Available when you check the Admin Input check box. Click Select to choose one or more admin input values.

          Override Admin Input Value check box

          Available when you check the Admin Input check box. Check this box to enable the user to replace the administrator value at runtime. Leaving this box unchecked hides the user's input control for this value at runtime.

          Input Filter Criteria text field

          Available when you click the Admin Input Filter check box. Type a filter expression to limit the values available at run time. See Admin Input Filters.

          Admin Input Value list

          Available when you click the Admin Input Filter check box. Displayed for reference—Use the column headings as attribute names in your filter expression.

          Select button and list

          Available when you click the Admin Input List check box. Click Select, then choose a value or values. All chosen values are available as user input choices at run time.

        3. If necessary, add more inputs by repeating the previous two substeps.
        Step 2   Click Next.
        Step 3   To enter outputs for the workflow, do the following.
        1. In the Workflow User Outputs screen, click the + icon at the top of the list of values.
        2. In the Add Entry To dialog box, complete the following fields:
          Name Description

          Output Label field

          The name or label of the output parameter.

          Output Description field

          A description of the output parameter.

          Optional check box

          Make the output parameter optional (not mandatory) at the time of workflow execution.

          Type field

          The data type of the output parameter. During the editing and saving of a workflow task, the Type field is no longer editable.

        3. If needed, add more outputs by repeating the previous two substeps.
        Step 4   Click Submit. The new workflow opens in the Workflow Designer.

        What to Do Next

        Add tasks to the workflow using the Workflow Designer. See Configuring a Task in a Workflow.

        Admin Input Filters

        Filtering Tabular Data

        When you create a workflow, you can limit the set of entries from a table or list of values seen by the user at run time. You do this by either choosing the values explicitly using an Admin Input List, or by using a filter expression (Admin Input Filter). This section describes the syntax for writing admin input filters.

        There are two types of data in Cisco UCS Director Orchestrator that you can filter:

        • Tabular data—A table with two or more columns. You filter the columns to choose the rows to display.

        • Lists of values (LOVs)—A list of items, all of the same type. You filter the values in the list.

        In addition, some inputs are numeric, for example, disk storage sizes. You must include units when you filter numeric inputs.

        To filter a tabular input, the input filter criteria have this form:

        column_label operator expression [ AND column_label operator expression ]

        where the elements of the expression are defined as follows:

        Field Entry

        column_label

        The label at the top of the column to be filtered. Type the name exactly as it appears. The label is case-sensitive and must include any spaces or special characters. Do not enclose the label in quotes.

        operator

        One of:

        • EQUALS

        • NOT_EQUALS

        • CONTAINS

        • NOT_CONTAINS

        • IS_SUBSET

        • NOT_SUBSET

        The operator name is case-sensitive; it must be all uppercase.

        IS_SUBSET and NOT_SUBSET are operators for list type inputs.

        [ ] (brackets)

        The brackets denote that the enclosed expression is optional and can be repeated. Do not include the brackets themselves in the filter criteria expression.

        AND

        Indicates extra criteria to be met. If one or more AND criteria are appended, all of them must be met to match a record.

        The criteria are applied serially. All records that meet the first criterion are subjected to the second criterion, then those results to the third, and so on.

        No operators besides AND can be used to append extra criteria. In particular, OR cannot be used. In other words, more criteria can be used only to narrow the search further, not to expand it.

        expression

        The syntax for expression is:

        match_expression [ OR match_expression ]
        OR

        Indicates a union of any of the specified match_expressions. In other words, only one of the match_expressions has meet the criterion for that part of the expression to be true.

        match_expression

        A simple regular expression that uses a subset of standard wildcard search characters and escape characters. The full POSIX regular expression syntax is not supported.

        You can match literal values provided they do not contain regex special characters or that you escape the special characters.

        For more information about regular expressions, consult any regular expression reference on the Internet; there are many.

        If match_expression is enclosed in quotes, a case-sensitive comparison is made, if applicable.

        Following is an example of a table-type filter:

        Cloud CONTAINS vcenter21 OR vcenter98 AND Power Status EQUALS off OR unknown

        The expression Cloud CONTAINS vcenter21 OR vcenter98 matches names containing vcenter21 and vcenter98, such as vcenter211 and TESTvcenter98. If you are interested only in vcenter21 and vcenter98, a better expression is Cloud EQUALS vcenter21 OR vcenter98.

        Filtering Lists of Values

        LOV types are lists of single values. To filter an LOV you therefore omit the column name and the AND operator. The top-level search syntax is:

        operator match_expression [ OR match_expression ]

        The elements of the syntax are as described for tabular data, with the exception that IS_SUBSET and NOT_SUBSET operators are not permitted.

        For example, if the power status values from the tabular data example were in an LOV, the search would look like this:

        EQUALS off OR unknown

        Filtering Numeric Data

        Certain numeric data such as disk size, LUN size, and volume size are specified with units--megabytes (MB), gigabytes (GB), or terabytes (TB). If the units are given in a table column, the units are part of the column label and must be included in your criteria; for example:

        LUN Size (GB) EQUALS 10.0

        Numeric expressions in filter criteria are regex matches and not numerical comparisons. For example, consider this filter criterion:

        LUN Size (GB) EQUALS 10

        The expression does not match records with LUN size given as 10.0.

        Configuring a Task in a Workflow

        Cisco UCS Director Orchestrator contains predefined tasks that you can use to create workflows. These tasks are organized in folders based on their functionality and can be accessed in the left panel of the Workflow Designer interface.

        Documentation for the predefined tasks is available by opening the Task Library; see Viewing the Task Library.


        Note


        Cisco UCS Director Orchestrator's predefined tasks cover many if not most of the common operations required in a typical environment. For operations not represented in the predefined tasks, you can create custom tasks. See the Cisco UCS Director Custom Task Getting Started Guide.

        To configure a predefined task for use in a workflow, do the following:


        Before You Begin

        Define a workflow and its inputs and outputs as described in the previous sections.


          Step 1   From the Workflows tab on the Orchestrator page, choose a workflow.
          Step 2   Click Workflow Designer. The Cisco UCS Director Orchestrator Workflow Designer window appears.
          Step 3   On the left side of the Workflow Designer, choose a category from the Available Tasks area by expanding folders in the task hierarchy.
          Step 4   Drag and drop your chosen task onto the Workflow Designer area.
          Step 5   In the Task Information screen, complete the following fields:
          Name Description

          Task Name field

          A name for this instance of the task. You can accept the automatically generated default or enter your own name for the task.

          Task Category drop-down list

          The category (also the folder name) in which the task appears. Cannot be changed.

          Task Type drop-down list

          The type (or generic name) of the task. Cannot be changed.

          Comment field

          An optional comment about this use of the task in this workflow.

          Retry Execution check box

          Check this box to retry the task if it fails. The Retry Count and Retry Frequency controls appear.

          Disable Rollback check box

          Check this box to disable the task's rollback script. If you check this box, the task is unchecked in the Rollback Service Request dialog and cannot be rolled back; see Rolling Back a Service Request.

          If the task does not support rollback, checking this box has no effect.

          Retry Count drop-down list

          The number of times (up to 5) to retry the task on failure.

          Retry Frequency field

          A comma-separated list of integers specifying how many seconds to wait between retries. For example, if you selected a retry count of three, enter 1, 10, 60 to retry after one, 10, or 60 seconds, respectively.

          Step 6   Click Next.
          Step 7   In the User Input Mapping screen, complete the following fields:
          Name Description

          Manage Workflow User Inputs button

          Click this button to add to or edit the workflow user inputs.

          Task Input headings

          Each task input is displayed as a heading on the remainder of this page. The input is labeled (Mandatory) if it required.

          Map to User Input check box

          Below each task input heading is a check box. Check this box to populate the task input from a workflow user input at runtime.

          User Input drop-down list

          This drop-down list appears if you check the Map to User Input check box. Select the workflow user input to map to the task input.

          Note   

          You cannot map a multiline workflow input to a single-line task input. The multiline workflow input does not appear in the User Input drop-down when creating or editing a task. See Defining Workflow Input and Output.

          Step 8   Click Next.
          Step 9   Any task input that was not mapped to a user input cannot be entered at runtime. Instead, specify the input value now. In the Task Inputs screen, complete the following fields:
          Name Description

          Task Input heading

          Each task input that was not mapped to a user input on the previous page is displayed with an appropriate input control (text field, drop-down list, and so on). Use the input controls to specify the value. Optional inputs can be left blank.

          Step 10   Click Next.
          Step 11   In the User Output Mapping screen, complete the following fields:
          Name Description

          Task Output heading

          Each task output is displayed as a heading on this page. The output is labeled (Mandatory) if it required.

          Map to User Output check box

          Below each task output heading is a check box. Check this box to populate a workflow user output from the task output at runtime.

          User Output drop-down list

          This drop-down list appears if you check the Map to User Output check box. Select the workflow user output to map to the task output.

          Step 12   Click Submit. If this is the first task configured in this workflow, the Workflow Designer automatically connects it to the default tasks. If the task is not the first, you must connect it manually.

          What to Do Next

          Connect the task to the workflow.

          Connecting a Task to a Workflow

          To be part of a workflow, a task must be connected to other tasks. You can insert a task anywhere in a workflow by dragging and dropping the flow arrows between tasks.

          There are three default tasks in every workflow: Start, Completed (Success), and Completed (Failure). When you add the first task to a workflow, it automatically connects to the default tasks.

          Before You Begin

          You have created a task in the Workflow Designer. The task is not yet part of the workflow.


            Step 1   Connect a task from the existing workflow to the new task. To connect the tasks:
            1. Mouse over the bottom of the task from which you want to map an output. The On success or On failure drop-down appears, depending on which side of the box your cursor occupies.
              Note   

              The Start task has only one (unlabeled) drop-down.

            2. Click and hold your left mouse button.
            3. Drag the cursor anywhere inside the task to which you are connecting, and release the mouse button. A colored arrow connects the two tasks, indicating the flow of operation from one task to the other.
            Note   

            Instead of dragging and dropping, you can click the down-arrow icon and choose the name of the task to which you want to connect. The colored arrow appears as if you had dragged it to that task.

            Note   

            Typically you connect a task's On success drop-down to the next task, and connect the On failure drop-down to the Completed (Failed) task. There are exceptions, however. For example, you could insert a task to do cleanup or error handling, in which case you would connect On failure to the cleanup task.

            However, the Workflow Designer does not permit you to connect a task's On success drop-down to the Completed (Failure) task.

            Step 2   Similarly, drag and drop from the On success drop-down of the new task to Completed (Success) or to another existing task in the workflow.

            Step 3   Drag and drop from the On failure drop-down of the new task to Completed (Failure) or to another existing task in the workflow.

            The task is integrated into the workflow. The Workflow Designer automatically arranges the tasks in the workspace.


            Note


            You can disable the automatic arrangement of the workflow by unchecking the Auto Layout check box at the top of the Workflow Designer.


            What to Do Next

            Add more tasks if necessary to complete the workflow. When you are finished, validate the workflow.

            Validating a Workflow

            Validating a workflow ensures that the inputs and outputs of its component tasks are connected with no major errors. You can validate a workflow without leaving the Workflow Designer.

            Before You Begin

            A workflow is open in the Workflow Designer.

            Click the Validate button. Task connection errors are displayed in red above the affected tasks. If no errors are detected, a success dialog pops up.

            What to Do Next

            If connection errors are displayed in the Workflow Designer, use the Workflow Validation tool to resolve the issues. See Resolving Workflow Validation Issues.

            Example: Creating a Workflow

            This simple example walks you through the creation of a workflow that power cycles (turns off and back on) a VM.

            Before You Begin

            You must have a VM available in Cisco UCS Director.


              Step 1   Define the workflow. Do the following:
              1. Navigate to Policies > Orchestration.
              2. Click the Workflows tab.
              3. Click the Add action.
              4. Complete the fields in the Add Workflow Details screen as follows:
                Field Entry

                Workflow Name field

                Type PowerCycleVM.

                Description field

                Type Shut down and restart a VM.

                Workflow Context drop-down list

                Select Any.

                Save as Compound Task check box

                Leave this unchecked.

                Always execute during System initialization check box

                Leave this unchecked.

                Place in New Folder check box

                Check this check box.

                Folder Nametext field

                Type OrchestrationExamples

                Notify status of execution to initiating user check box

                Leave this unchecked.

                Email policy drop-down list

                Choose No email.

                Version Label text field

                Leave the default value, 0.

              5. Click Next.
              Step 2   Define an input to specify the name of the VM. Do the following:
              1. In the Workflow User Inputs screen, click the + icon at the top of the list of values.
              2. Complete the fields in the Add Entry To dialog box as follows:
                Field Entry

                Input Label field

                Type VM Name.

                Input Description field

                Type Name of the VM to power cycle.

                Optional check box

                Leave this unchecked.

                Input Type button

                Click the button labeled Select .... The Select dialog comes up.

              3. In the Select dialog, type vm selector in the search box.
              4. Click the check box next to the VM Selector entry.
              5. Click Select.
              6. Define an administrator (fixed) value for the VM name by completing the next set of fields as follows:
                Field Entry

                Admin Input check box

                Check this check box.

                Admin Input Filter and Admin Input List check boxes

                These check boxes disappear when you check Admin Input. Both of these check boxes enable the administrator to filter the choices available to the user when the workflow is run. Instead, for this example, the Admin Input Value supplies a single fixed value at runtime.

                h

                Override Admin Input Value check box

                Leaving this box unchecked hides the user's input control for this value at runtime. For this example, leave the box unchecked.

                Admin Input Value button

                Click Select to choose a value for the administrator input. The Select list of values comes up.

                Click a check box to select an existing VM instance, then click Select.

              7. Click Next.
              Step 3   Do not define an output. Click Submit.

              The Workflow Designer window appears.

              Step 4   Add a task to power off the VM by doing the following:
              1. In the Available Tasks search field at the top left of the Workflow Designer window, type power. The Available Tasks window now displays only tasks containing the string power.
              2. From the Generic VM Tasks folder, drag and drop the VM Power Action icon into the work area. The Add Task dialog appears.
              3. In the Task Information dialog, type Power Off 1 in the Task Name text field.
              4. Click Next.
              5. In the User Input Mapping dialog, complete these fields:
                Field Entry

                Map to User Input check box

                Check this check box.

                User Input drop-down list

                Since there is only one user input of the correct type (or of any type, in this case), the user input name that you created (VM Name) is already selected in the drop-down list.

              6. Click Next.
              7. In the Task Inputs dialog's VM Action drop-down list, select Power OFF.
              8. Click Next.
              9. Click Submit. The task is automatically connected in the new workflow.
              Step 5   Add a task to power on the VM. The procedure is similar to the previous step, with the following differences:
              • In the Task Information dialog, type Power On 1 in the Task Name text field.

              • In the Task Inputs dialog's VM Action drop-down list, select Power ON.

                Note   

                You could create this workflow with a single Reboot task rather than powering off and back on. However, for purposes of this example go ahead and create the workflow with the two power management tasks.

              • When you click Submit, the task does not automatically connect to the existing workflow. Instead, connect it by hand:

                1. Mouse over the lower left corner of the Power Off 1 task icon. The On Success drop-down appears.

                2. Drag and drop from the On Success drop-down area to anywhere in the Power On 1 icon.

                  The Power On 1 task is inserted between the Power Off 1 task and the Completed task.

                3. Using the same drag-and-drop technique, connect the Power On 1 > On Failure drop-down to the Completed (Failed) task.

              Step 6   Validate the workflow by clicking Validate Workflow button at the top of the Workflow Designer. The Valid Workflow dialog comes up, confirming that the workflow and task inputs and outputs are connected properly.
              Step 7   Click Close to leave the Workflow Designer.

              Resolving Workflow Validation Issues

              Cisco UCS Director supplies a wizard-based tool to aid you in troubleshooting workflow validation errors.

              Before You Begin

              A workflow has failed validation in the Workflow Designer.


                Step 1   On the menu bar, choose Policies > Orchestration.

                Step 2   Click the Workflows tab.
                Step 3   Choose the workflow that failed validation.
                Step 4   Click Validate Workflow.
                Step 5   In the Workflow Validation dialog box, double click the description under Resolution.
                Step 6   In the Validation Errors dialog box, view the summary for the issue detected. Complete the remaining prompts in the wizard to resolve the validation error.

                Changing Flow of Control in Workflows

                Normally, a workflow executes as a linear series of tasks. However, Cisco UCS Director Orchestrator provides tasks that enable changes to the flow of control within a workflow. The following sections describe how to create these flow-of-control constructs:

                • Loops.

                • If-then branches.

                • Conditional switches with an arbitrary number of branches.

                Looping in Workflows

                You can create a loop to perform a selected series of tasks multiple times. A loop can be configured to iterate one of two ways:

                • By count—Iterate a specified number of times.

                • By item—Iterate over a list of items.

                Before You Begin

                Open a workflow in which you want to include a loop in the Workflow Designer.


                  Step 1   In the Available Tasks pane of the Workflow Designer, click the Procedural Tasks folder.
                  Step 2   Drag the Start Loop task into the Workflow Designer work area.
                  Step 3   In the Add Task window, complete the following fields:
                  Name Description

                  Task Name field

                  The name of the task.

                  Comment field

                  Comments for the task.

                  Retry Execution check box

                  Check the check box to retry later if the task fails.

                  Retry count drop-down list

                  Choose the number of retry attempts.

                  Retry Frequency drop-down list

                  Choose the duration between retry attempts.

                  Step 4   Click Next.
                  Step 5   In the User Input Mapping screen, click Next.
                  Step 6   In the Task Inputs screen, complete the following fields:
                  Name Description

                  List based iteration check box

                  Check this check box to perform the loop tasks on every item in a list. The following two fields appear.

                  Input for list-based iteration

                  Choose a list of input values for the list-based iteration.

                  User Input to assign iterated values drop-down list

                  The user input for the list-based iteration.

                  Create a workflow input with the same type as your list elements and map it to the Start Loop task here.

                  Count based iteration check box

                  Check this check box to perform loop tasks based on a count. The following field appears.

                  Number of times to loop field

                  The number of times to perform the loop.

                  Step 7   In the User Output Mapping screen, click Submit.
                  Step 8   From the Available Tasks pane, drag the tasks that you want as part of the loop.
                  Step 9   Create links between the task icons in the loop using the On Success connector.
                  Step 10   Create a link between the Start task icon (or whichever task is immediately before the loop) and the Start Loop task icon.
                  Step 11   In the Available Tasks pane, click the Procedural Tasks folder.
                  Step 12   Drag the End Loop task into the Workflow Designer.
                  Step 13   Complete the remaining screens in the Add Task (End Loop) wizard.
                  Step 14   Click Submit.
                  Step 15   Connect the On Success connector of the last task in the loop to the End Loop task icon.
                  Step 16   In the End Loop task icon, connect the On Success connector to the Completed (Success) or to another task to execute after the loop.
                  Step 17   In the End Loop task icon, connect the On Failure connection to the Completed (Failure) (or another task) task icon.

                  Example: Looping in a Workflow

                  This example demonstrates repeating workflow tasks for elements in a list. You will modify the PowerCycleVM workflow to restart a list of VMs instead of a single VM.

                  Before You Begin

                  Create the example workflow as described in Example: Creating a Workflow.


                    Step 1   Open the PowerCycleVM workflow.
                    1. Navigate to Policies > Orchestration.
                    2. Click on the Workflows tab.
                    3. Locate and select the PowerCycleVM workflow you created in Example: Creating a Workflow.
                    4. Click on Workflow Designer.
                    Step 2   Add the Start Loop task to the workflow.
                    1. From the Available Tasks window in the Procedural Tasks folder, drag and drop Start Loop onto the work area.
                    2. In the Task Information window, complete the following fields:
                      Field Entry

                      Task Name text field

                      Type StartVMLoop.

                      Comment text field

                      Type Loop through a list of VMs

                      Task Details heading

                      Make a note of the message under the Task Details heading regarding the task output START_LOOP_OUTPUT.

                    3. Click Next.
                    4. Replace the workflow input to accept a list of VMs

                      . In the User Input Mapping window, click Manage Workflow User Inputs.

                    5. Click the Add icon.
                    6. In the Add Entry To dialog, complete the following fields:
                      Field Entry

                      Input Label text field

                      Type VM Names.

                      Input Description text field

                      Type List of VMs to restart..

                      Optional checkbox

                      Leave this unchecked.

                      Input Typebutton

                      Click this button to bring up the Select list of values.

                      Use the search box to locate and select multiVM as the input type.

                      Click Select.

                      Value Restrictions heading

                      Click the Admin Input checkbox.

                      Click Select.

                      Choose several VMs , then click Select.

                    7. Click Submit.
                    8. On the User Input Mapping window, under the Input for list based iteration heading, check the Map to User Input checkbox. The User Input drop-down list appears.
                    9. In the User Input drop-down list, select VM Names.
                    10. Click Next.
                    11. Check the List based iteration checkbox. The User input to assign iterated values drop-down list appears.
                      Note   

                      This field is a feature of the Start Loop task. Since the output variable START_LOOP_OUTPUT is of type generic text, it cannot (usually) be mapped to the input of the tasks inside the loop. Instead, the Start Loop task assigns each item of the input list to the variable as it iterates.

                    12. Select VM Name in the User input to assign iterated values drop-down list.
                      Note   

                      There is nothing special about the VM Name workflow input variable; you are reusing it since you no longer need it as input to the workflow. (The workflow input is now VM Names, which is a list of VMs.)

                    13. Click Next.
                    14. There is no output mapping, so click Submit to save the task.
                    15. Drag and drop to connect the Start task to the StartVMLoop task. The Workflow Designer connects the StartVMLoop > On Success dropdown to the Power Off 1 task (because it was the previous target of the Start task).
                    16. Drag and drop to connect the StartVMLoop > On failure dropdown to the Completed (Failed) task.
                    Step 3   The End Loop task is just a placeholder with no inputs or outputs. To add the End Loop task to the workflow, do the following:
                    1. Drag and drop the End Loop task from the Procedural Task folder onto the work area.
                    2. In the Task Information window, complete the following fields:
                      Field Entry

                      Task Name text field

                      Type EndVMLoop.

                      Comment text field

                      Type End of VM loop.

                    3. Click Next.
                    4. In the User Input Mapping window, click Next.
                    5. In the Task Inputs window, click Next.
                    6. In the User Output Mapping window, click Next.
                    7. Drag and drop to connect the Power On 1 task to the EndVMLoop task.
                    8. Drag and drop to connect the EndVMLoop > On failure dropdown to the Completed (Failed) task.
                    Step 4   Click Close to close the Workflow Designer.

                    What to Do Next

                    Execute the task to restart the VMs specified in the workflow.

                    Adding an If-Then Branch to a Workflow

                    You can create a two-way branch in a workflow using an if-then construct.

                    Before You Begin

                    You have a workflow open in the Workflow Designer.


                      Step 1   In the Available Tasks pane of the Workflow Designer, click the Procedural Tasks folder.
                      Step 2   Drag the If Else task into the Workflow Designer work area.
                      Step 3   In the Add Task screen, complete the following fields:
                      Name Description

                      Task Name field

                      The name of the task.

                      Comment field

                      Comments for the task.

                      Retry Execution check box

                      Check the check box to retry later if the task fails.

                      Retry count drop-down list

                      Choose the number of retry attempts.

                      Retry Frequency drop-down list

                      Choose the duration between retry attempts.

                      Step 4   Click Next.
                      Step 5   In the User Input Mapping screen, click Next.
                      Step 6   In the Task Inputs screen, complete the following fields:
                      Name Description

                      Specify the condition field

                      Enter the condition evaluated to determine the course of the workflow. The flow of control depends on whether the condition evaluates to true or to false.

                      The conditions that you define must contain only the following operators:

                      ==, !=, <, <=, >, >=, ||, &&, contains, startsWith, endsWith

                      Following are some example conditions:
                      • TaskName.OUTPUT_ATTRIBUTE_NAME == "2"

                      • WORKFLOW_USERINPUT_LABEL_NAME contains "xyz"

                      • TaskName.OUTPUT_ATTRIBUTE NAME == WORKFLOW_USERINPUT_LABEL_NAME || WORKFLOW_USERINPUT_LABEL_NAME != "123"

                      Step 7   In the User Output Mapping screen, click Submit.
                      Step 8   In the If-Else task icon, click and drag the True connector and the False connector to other task icons.
                      Step 9   In the If-Else task icon, click and drag the On Failure connector to the Completed (Failed) task icon (or another task icon).
                      Note   

                      Do not confuse the False and On Failure connectors. The False connector defines the path if the condition statement evaluates to false. The On Failure connector defines the path for failure of the task, for example if the task cannot evaluate the condition statement.


                      Using Conditional Branching in a Workflow

                      You can create a multiple-path branch in a workflow using a conditional construct. A single conditional task can have any number of branches.

                      Before You Begin

                      You have a workflow open in the Workflow Designer.


                        Step 1   In the Available Tasks pane of the Workflow Designer, click the Procedural Tasks folder.
                        Step 2   Drag the Conditional task intoWorkflow Designer work area.
                        Step 3   In the Add Task screen, complete the following fields:
                        Name Description

                        Task Name field

                        The name of the task.

                        Comment field

                        Comments for the task.

                        Retry Execution check box

                        Check the check box to retry later if the task fails.

                        Retry count drop-down list

                        Choose the number of retry attempts.

                        Retry Frequency drop-down list

                        Choose the duration between retry attempts.

                        Step 4   Click Next.
                        Step 5   In the User Input Mapping screen, click Next.
                        Step 6   In the Task Inputs screen, click the + icon to add a condition statement for each execution path of the workflow. For example, if your workflow has three possible execution paths, add three entries into the conditions table, one entry for each condition. Click the default entry in the table to specify the condition when the workflow takes the default execution path.
                        Note    The condition statements do not have to be mutually exclusive. At run time, the statements are evaluated in the order they are listed. Execution continues with the path of the first statement to evaluate to true.
                        Step 7   In the Add Entry to screen, complete the following fields:
                        Name Description

                        Label field

                        The label for the condition

                        Condition field

                        Enter the condition to be evaluated to determine the course of the workflow. The conditions that you define must contain the following operators:

                        ==, !=, <, <=, >, >=, ||, &&, contains, startsWith, endsWith

                        Following are some examples that you can use while specifying conditions:
                        • TaskName.OUTPUT ATTRIBUTE NAME=="2"

                        • WORKFLOW USERINPUT LABEL NAME contains "xyz"

                        • TaskName.OUTPUT ATTRIBUTE NAME == WORKFLOW USERINPUT LABEL NAME || WORKFLOW USERINPUT LABEL NAME != "123"

                        Click Submit.

                        Step 8   In the User Output Mapping screen, click Submit.
                        Step 9   From the Available Tasks pane, click and drag the tasks that you want to add to the various execution paths of the workflow.
                        Step 10   Create a link between the Start task icon (or whichever task is immediately before the branch) and the Conditional task icon.
                        Step 11   For each condition in the conditional task, create a link between the connector in the Conditional Task icon to the next task for the condition's execution path. For example, link the default connector in the Conditional task icon to the task you want to execute if none of the other conditions are met.
                        Step 12   Link the On failure connector to the Completed (Failed) (or another task) task icon.

                        Creating Approvals

                        To require approval of a user, you add an approval task to the workflow.

                        Before You Begin

                        Open a workflow in the Workflow Designer.


                          Step 1   In the Workflow Designer Available Tasks window, open Cloupia Tasks > General Tasks.
                          Step 2   Drag the User Approval task onto the work area.
                          Step 3   Configure the task. See Configuring a Task in a Workflow. Complete the following fields:
                          Name Description

                          Task Name field

                          The task name.

                          Comment text box

                          A comment about the approval task (Optional.)

                          Retry Execution check box

                          Leave this box unchecked. If the administrator rejects the approval, the workflow stops with the approval task in a failed state. If you enable execution retries, the workflow presents the administrator with an approval multiple times. This is probably not the behavior you want from the workflow.

                          Step 4   Click Next.
                          Step 5   In the User Input Mappings click Next. You define all the task inputs in the Task Inputs window.
                          Step 6   In the Task Inputs window, complete the following fields:.
                          Step 7  
                          Name Description

                          User ID Select button

                          Click Select and use the Select dialog to choose the user whose approval is required to execute this workflow. Then click Submit.

                          Approval required from all the users check box

                          You can ignore this check box.

                          Number of approval request Reminder fields

                          Type the number of times to remind the user to approve this workflow. Entering 0 causes the reminder to be sent until the workflow approval has been approved or rejected.

                          Reminder Interval (Hours) field

                          Type the number of hours between approval reminders.

                          Step 8   Click Next.
                          Step 9   In the User Output Mapping window, click Submit.