Product Documentation

Configuring Custom Tasks

Mar 23, 2010

Custom tasks are user-defined configuration tasks that you can add in Command Center to perform a defined set of operations on the managed devices. These tasks may contain a heterogeneous set of commands, such as CLI commands, SHELL, or Secure File Transfer Protocol (SFTP), that you can execute on a single device or a set of devices grouped together in a device list.

Use the following procedures for configuring custom tasks:

Adding Custom Tasks

You can add custom tasks using one of the following methods:

  • Define new commands: Create a new task by defining task variables and commands. 
  • Import from command file: Create a task from a command file. A command file is a text file containing a list of commands that constitute a task; the content could be a snippet of the ns.conf file. Each command may be a NetScaler CLI, Shell, or FTP command. You must have the command file present on the Command Center server or on the local file system. 
  • Import from task file: Create a task from an existing task file. Use this option to enhance or modify an existing task. For example, you can create a new task from a built-in task or import a task already created on another Command Center server. You must have the task file present on the Command Center server or on the local file system.

 

With custom tasks, you have the option to configure task operations in the following ways:

Execute Sequentially: Execute a task on a set of devices, one device at a time. If task execution fails on any device, it does not continue on the remaining devices . By default, if you do not select this option, the task will be executed in parallel.

Execute on Inaccessible System(s): If the selected devices or the device list include any inaccessible devices (discovery failed devices), the task is executed on these devices as well as on the others.
Enable Role-Based Authorization (RBA): Allow task execution by authorized users only. Specify the user names and passwords of the authorized users. RBA works in the following scenarios:
  • If you enable RBA globally on the Admin tab, regardless of the task-level setting, a custom task is executed only after you provide RBA credentials.
  • If you do not enable RBA globally, task execution prompts for RBA credentials based on the task-level settings.

Enable Automated Rollback (auto rollback): Generates rollback commands at runtime by fetching these commands based on the version of the operating system of the device. The auto rollback feature is supported only on Citrix NetScaler versions 8.1 and later. It is not supported on CloudBridge devices. This feature ensures that task execution behaves as a transaction such that if even one command execution within a task fails, the entire task is rolled back. Auto rollback is an enhancement over the existing manual rollback mechanism where you need to manually type the rollback commands. This feature identifies the NetScaler version (both major and minor) and accordingly determines the appropriate command that must be used to reverse the configuration, if required.

If you configure a task to support the auto rollback feature, the preview screen displays the actual executable commands and the corresponding rollback commands in a tabular format for devices selected in the device list. However, if you configure a task to not support the auto rollback feature, the preview screen displays the actual commands sequentially.

You may encounter errors in the following scenarios:
  • When the auto rollback feature is not supported for a particular device version.
  • When there are no CLI commands in a task.

Adding New Custom Tasks

You can create a custom task form start by defining commands and task variables.

To add new custom tasks

  1. On the Configuration tab, in the left pane, under Configuration, click Custom Tasks.
  2. In the right pane, under Custom Tasks, click Add.
  3. Under Custom Task Add Options, click Define new commands, and then click Next.
  4. Under Add custom task, in Task Name, type the name of the task, and in Description, type the description of the task you want to create.
  5. In Category, select the category of the task, or click + (plus) to add a new category.
  6. In Device Family, select the type of device on which you want to execute the task. The NetScaler device family also includes NetScaler Gateway Enterprise and NetScaler VPX device types.
  7. Specify the select one or more of the following check boxes:
    • Execute Sequentially: Specifies whether to execute the task on the devices in a sequential manner.
    • Execute on Inaccessible system(s) also: Specifies whether to execute the task on inaccessible devices.
    • Enable RBA: Specifies whether the user should provide user credentials before task execution.
    • Enable Auto Rollback: Specifies whether rollback commands are generated implicitly during runtime. When you select this check box, you do not need to manually type rollback commands when adding actual commands in step 8.
    • Save configuration on success: Specifies whether the custom task is saved implicitly by Command Center on the NetScaler and CloudBridge devices. If you select this option, you do not have to explicitly add the save config command when creating a custom task.
  8. Click Add Command.
  9. In the Command dialog box, in Command, type the command you want to execute. This must be the actual command that you need to execute on the managed device. The commands you define here may use the task variables. The following is a sample command for creating and binding a filter policy:
    add filter policy $policyname$ -rule $expression$ 
     -$actionType$ $actionname$ bind filter global $policyname$
    
    Note: You must enclose task variables between the $ symbols.
  10. In Protocol, select the protocol you want to associate with the command.
  11. In Rollback, type the rollback command to use if the actual command fails.
    Note: If you have selected the Enable Auto Rollback option in step 7, you do not need to type the rollback command here.
  12. Click OK.
  13. In the Add custom task, click Add Task Variable.
  14. In the Variable dialog box, specify the variable information, and then click OK.

Adding Custom Tasks from Command Files

You can add a custom task from a command file that contains the commands to be executed on the devices.

A command file is a text file containing a list of commands that constitute a task; the content could be a snippet of the ns.conf file. Each command may be a NetScaler CLI, Shell, or FTP command. You must have the command file present on the Command Center server or on your local system.

To add custom tasks from command files

  1. On the Configuration tab, in the left pane, under Configuration, click Custom Tasks.
  2. In the right pane, under Custom Tasks, click Add.
  3. Under Custom Task Add Options, click Create Task from command file, and then click Browse.
  4. In the Choose File dialog box, select the command file you want to use, click Open, and then click Next.
  5. Under Add Custom Task, select one or more of the following check boxes:
    • Execute Sequentially: Specifies whether to execute the task on the devices in a sequential manner.
    • Execute on Inaccessible system(s) also: Specifies whether to execute the task on inaccessible devices also.
    • Enable RBA: Specifies whether the user should provide user credentials before task execution.
    • Enable Auto Rollback: Specifies whether rollback commands are generated implicitly during runtime.
  6. In the Add custom task, click Add Task Variable.
  7. In the Variable dialog box, specify the variable information, and then click OK.

Adding Custom Tasks by Importing from Task Files

You can add a custom task from an existing task file. You can also enhance or modify an existing task to create a new task. For example, you can create a new task from a built-in task, or import a task already created on another Command Center server. You must have the task file present on the Command Center server or on your local system.

To add custom tasks by importing from task files

  1. On the Configuration tab, in the left pane, under Configuration, click Custom Tasks.
  2. In the right pane, under Custom Tasks, click Add.
  3. Under Custom Task Add Options, click Import from task file, and then click Choose File.
  4. In the Choose File dialog box, select the task file you want to use, click Open, and then click Next.
  5. Under Add Custom Task, select one or more of the following check boxes:
    • Execute Sequentially: Specifies whether to execute the task on the devices in a sequential manner.
    • Execute on Inaccessible system(s) also: Specifies whether to execute the task on inaccessible devices.
    • Enable RBA: Specifies whether the user should provide user credentials before task execution.
    • Enable Auto Rollback: Specifies whether rollback commands are generated implicitly during runtime.
  6. In the Add custom task, click Add Task Variable.
  7. In the Variable dialog box, specify the variable information, and then click OK.

Executing Custom Tasks

You can execute a custom task on multiple devices at the same time. You can either select devices individually or select a device list for the tasks. You can execute the same task several times on different devices or device lists. You can also preview a task (the commands and rollback commands) before executing it.

To execute custom tasks

  1. On the Configuration tab, in the left pane, under Configuration, click Custom Tasks.
  2. In the right pane, under Custom Tasks, select the custom task you want to execute, and then click Execute. Alternately, right-click the custom task and click Execute.

Viewing the Execution Log for Specific Custom Tasks

After executing a task, you can view the following execution details of that task instantly or at a later time.

To view the execution log for specific custom tasks

  1. On the Configuration tab, in the left pane, under Configuration, click Custom Tasks.
  2. In the right pane, under Custom Tasks, select the custom task whose execution details you want to view, click Execution Log, and follow the wizard instructions.
  3. Under Execution Log, you can view the following:
    • Task Name: Specifies the task name.
    • Device Name: Specifies the IP address of the device on which the task is executed.
    • Start Time: Specifies the time when the task started.
    • End Time: Specifies the time when the task ended.
    • CC User: Specifies the Command Center user who initiated the task.
    • Device User: Specifies the NetScaler or CloudBridge user who initiated the task.
    • Status: Specifies the completion status of the task, such as Success, Failed, and Queued.
    • Annotation: Specifies a message that is annotated when executing the task.

Note: You can also view an execution log for all executed custom tasks by clicking Execution Log under Configuration in the left pane.

Scheduling Custom Tasks

You can schedule custom tasks to execute at a later period or recur at regular intervals. For example, you can schedule tasks to be executed at specific hours daily, at specific hours on specific days of the week, and at specific hours on specific days of the month.

To schedule custom tasks

  1. On the Configuration tab, in the left pane, under Configuration, click Custom Tasks.
  2. In the right pane, under Custom Tasks, select the custom task you want to execute, click Schedule, and follow the prompts in the wizard. Alternately, right-click the custom task, click Schedule, and then follow the prompts in the wizard.

Note: To view scheduled custom tasks, in the right pane, under Custom Tasks, on the bottom bar, click Scheduled Tasks. You can stop, resume, or remove a scheduled custom task.

Exporting Custom Tasks

You can save the custom tasks in XML format on the Command Center server. This XML file, also known as task file, can be used to create a new custom task in the existing server, or can be copied to another Command Center server.

Note: The location of the exported file is CC_Home\provisioningtemplates\exportedtemplates.

To export custom tasks

  1. On the Configuration tab, in the left pane, under Configuration, click Custom Tasks.
  2. In the right pane, under Custom Tasks, select the task you want to export, and then click Export.
  3. Under Export Task, in Name, type a name for the task file, and then click OK. A message appears confirming that the selected task is successfully exported.

Modifying Custom Tasks

You can modify the values of the fields in a custom task.

To modify custom tasks

  1. On the Configuration tab, in the left pane, under Configuration, click Custom Tasks.
  2. In the right pane, under Custom Tasks, select the task you want to export, and click Modify.
  3. Under Modify custom task, make changes to the fields you want to modify, and then click OK.

Deleting Custom Tasks

If you do not want to use a custom task again, you can delete it.

To delete custom tasks

  1. On the Configuration tab, in the left pane, under Configuration, click Custom Tasks.
  2. In the right pane, under Custom Tasks, select the task you want to export, and then click Delete. Alternately, right-click the task, and click Delete..
  3. In the confirmation message box, click OK.