Skip to main content
Version: Deploy 22.3

Use control tasks

Control tasks are actions that you can perform on middleware or middleware resources. For example, checking the connection to a host is a control task. When you trigger a control task, Deploy starts a task that executes the steps associated with the control task.

View control task in the GUI

To view a list of control task in the GUI:

  1. Click Monitoring.
  2. Click Control Tasks. Note: By default, Monitoring only shows the tasks that are assigned to you. To see all tasks, click All tasks.

Trigger a control task from the GUI

To trigger a control task on a configuration item (CI) in the GUI:

  1. In the top navigation bar, click Explorer.
  2. Locate the CI on which you want to trigger a control task. Click Explorer action menu to see the control tasks that are available.
  3. Select the control task to trigger it. Note: Some control tasks will require you to provide values for parameters before Deploy executes the task.

Trigger a control task from the CLI

You can execute control tasks from the Deploy command-line interface (CLI). You can find the control tasks that are available in the CI reference documentation for each plugin. For example, the glassfish.StandaloneServer CI includes a start control task that starts a GlassFish server. To execute it:

deployit> server = repository.read('Infrastructure/demoHost/demoServer')
deployit> deployit.executeControlTask('start', server)

Some control tasks include parameters that you can set. For example:

deployit> server = repository.read('Infrastructure/demoHost/demoServer')
deployit> control = deployit.prepareControlTask(server, 'methodWithParams')
deployit> control.parameters.values['paramA'] = 'value'
deployit> taskId = deployit.createControlTask(control)
deployit> deployit.startTaskAndWait(taskId)

Add a control task to an existing CI type

To add a control task to an existing CI type such as Host, you can extend the Generic plugin as follows:

  1. Define a custom container that extends the generic container. The custom container should define the control task and the associated script to run. The script is a FreeMarker template that is rendered, copied to the target host, and executed. For example, in synthetic.xml:
    <type type="mycompany.ConnectionTest" extends="generic.Container">
    <!-- inherited hidden -->
    <property name="startProcessScript" default="mycompany/connectiontest/start" hidden="true"/>
    <property name="stopProcessScript" default="mycompany/connectiontest/stop" hidden="true"/>
    <!-- control tasks -->
    <method name="start" description="Start some process"/>
    <method name="stop" description="Stop some process"/>
    </type>
  2. In the Deploy Library, create the container under the host that you want to test.
  3. Execute the control task.

Create a custom control task

For information on writing your own Deploy control task, see Create a custom control task.