Updated on 2024-06-28 GMT+08:00

Jobs

The Jobs page displays all job information. You can create a job, create or delete an execution plan, and release the execution plan as a service. You can view the released service in Scenarios.

Precautions

  • You can create up to 1000 jobs.
  • Up to 20 global parameters, 20 steps, and 50 execution plans can be created for each job.

Creating a Job

  1. Log in to the AOM 2.0 console.
  2. In the navigation pane, choose Automation (Retiring). The Automation page is displayed.
  3. In the navigation pane, choose Jobs. On the displayed page, click Create Job.
  4. Set parameters by referring to Table 1.

    Figure 1 Creating a job
    Table 1 Parameters for creating a job

    Parameter

    Description

    Job Name

    Name of a job.

    Enter up to 64 characters. Only letters, digits, and underscores (_) are allowed.

    Enterprise Project

    Select the enterprise project to which the job belongs.

    Description

    Description of a job. Enter up to 1000 characters.

  5. Add global parameters.

    1. On the Create Job page, click Add Global Parameter in the Global Parameters area.
    2. Set global parameters by referring to Table 2.
      Figure 2 Adding global parameters
      Table 2 Global parameters

      Parameter

      Description

      Method

      Mode for adding parameters. Options: Create and Select existing parameter.

      Parameter Type

      • Create: The parameter type can be String (default) or Host.
      • Select existing parameter: The parameter type can only be String.

      Parameter Name

      • Create: The parameter name can contain up to 64 letters.
      • Select existing parameter: Select a parameter from the parameter library. After a parameter is selected from the parameter library, the parameter is saved in the job and is no longer associated with the parameter in the parameter library.

      Encrypt

      By default, this option is disabled. Encryption is not supported at present.

      Initial Value

      • For parameter type String, the initial value can contain up to 1000 characters.
      • For parameter type Host, click Add to add up to 100 instances.

      Mandatory

      Specifies whether the parameter is mandatory. The default value is Yes.

      Input Prompt

      Parameter input prompt. Enter up to 1000 characters.

      Description

      Parameter description. Enter up to 1000 characters.

    3. Click Save. You can also click Submit and Save to Parameter Library to add the parameter and create a parameter with the same name in the parameter library.

  6. Add a job step.

    1. On the Create Job page, click Add in the Job Step area.
    2. Set job step parameters by referring to Table 3.
      Figure 3 Adding a job step (script)
      Figure 4 Adding a job step (package)
      Table 3 Parameters for adding a step

      Category

      Parameter

      Description

      -

      Step Name

      Name of a step.

      Enter up to 32 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

      Step Type

      Type of a step. Options: Scripts, Packages, and Pause.

      Description

      Step description. Enter up to 1000 characters.

      Timeout Duration

      Timeout duration of a script installation or uninstallation task. The value must range from 1 to 43,200.

      Execution Account

      Name of the OS account that executes the script.

      Target Instances

      • Global Parameter: Select a host parameter from the drop-down list.
      • Add: Manually add ECSs or select them from CMDB.

      Scripts

      Script

      Select a script from the script list. The drop-down list displays only released scripts.

      Script Content

      • Script version and script content.
      • After setting the parameters, click Check for High-Risk Commands. High-risk commands undergo regular expression verification. If the verification fails, risks may occur. For details about high-risk commands, see Table 1.

      Script Parameters

      Separate multiple parameters with spaces.

      Global variables in the string format can be referenced using ${var_name}.

      Sensitive

      If you select Sensitive, the content you enter will not be displayed in the script parameter box. By default, Sensitive is not selected.

      Error Handling

      • If you select Ignore Error, the system continues to execute the next step after the current job step fails.
      • If you do not select Ignore Error, the job will be paused after a job step fails. In that case, click Retry or skip this step.

      Packages

      Package Name

      Name of a package. Select a package name from the drop-down list. Only released packages are displayed in the drop-down list.

      Version

      Software version, which is automatically obtained based on the selected package name.

      Operation

      Operation type, which can be Install or Uninstall.

      Storage Path

      Global variables in the string format can be referenced using ${var_name}.

      Source Files

      Enter the source of the selected package version. For details, see Table 1.

      Platform

      Platform on which the package runs. Currently, only Linux is supported.

      Script Type

      • If Operation is Install, Script Type is Install. The Pre-install dialog box displays the pre-installation script. The Install dialog box displays the installation script. Up to 1000 characters can be displayed.
      • If Operation is Uninstall, Script Type is Uninstall. The Uninstall dialog box displays the uninstallation script. Up to 1000 characters can be displayed.

      Pause

      Description

      Step description. Enter up to 1000 characters.

  7. Perform the operations listed in Table 4 if needed.

    Table 4 Related operations

    Parameter

    Description

    Execution Policy

    • Batch Release: specifies whether to enable batch release. By default, this function is disabled.
    • Instances for Each Batch: number of instances on which tasks can be executed at the same time.
    • Interval: interval for executing each batch of tasks.

    Review

    • Manual review. If there is any risky operation, a review is recommended. By default, this function is disabled.

  8. Click Save.
  • If the information for adding a job step is incomplete, "Insufficient information" will be displayed after you save the settings.
  • To adjust step sequence, drag at the beginning of the row where the job step is located.
  • To delete a step, click in the row that contains the target step.

Creating an Execution Plan

After a job is created, create an execution plan for the job:

  1. In the navigation pane, choose Jobs. Then, click the desired job.

    Figure 5 Clicking a job

  2. Click Select Plan in the upper right corner.
  3. On the plan list page, click Create Execution Plan in the upper right corner.
  4. Set parameters by referring to Table 5.

    Figure 6 Creating an execution plan
    Table 5 Parameters for creating an execution plan

    Parameter

    Description

    Plan Name

    Name of a plan.

    Enter up to 64 characters. Only letters, digits, and underscores (_) are allowed.

    Global Parameters

    Global parameters that have been added. You can view their details and change their initial values.

    Steps

    Steps to be performed. You can select one or more steps. Click a step to view its details.

  5. Click Submit.

Executing a Plan

After an execution plan is created, execute it:

  1. In the navigation pane, choose Jobs. Then, locate the desired job, and click View Execution Plan in the Operation column. On the displayed page, locate the desired plan and click Execute in the Operation column.

    Figure 7 Executing a plan

  2. On the task creation page, click Execute.

    If you set Parameter Type to Host during global parameter adding and click Execute, the message "Are you sure you want to perform the operation on the following instance?" will be displayed. Click Yes.

  3. On the task execution page, view the task execution status.

    • : The task fails to be executed.
    • : The task has been executed successfully.
    • : The task is being executed or has been paused.
    • : The task has not been executed yet.
      Figure 8 Plan execution details

Publishing an Execution Plan as a Service

The execution plan of a job can be published as a service card. After it is published, you can view it on the Scenarios page. To publish an execution plan as a service, you must have the cms:publish:update or cms:toolmarket:update permission. For details about operations related to service cards, see Scenarios.

  1. In the navigation pane, choose Jobs. Then, locate the desired job, and click View Execution Plan in the Operation column. On the displayed page, locate the desired plan and click Publish as Service in the Operation column.

    Figure 9 Publishing an execution plan as a service

  2. Enter basic information and click OK. For details, see Table 6.

    Figure 10 Publishing a plan as a service
    Table 6 Parameters for publishing a plan as a service

    Parameter

    Description

    Service Name

    Name of a service. Enter up to 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

    Scenario

    Scenario where the service is used. Options: Common, Software Deployment, Troubleshooting, and Routine Inspection.

    Description

    Description of the service to be released. Enter up to 1000 characters.

Canceling a Published Plan

You can cancel an execution plan that has been published as a service. After the published plan is canceled, it will be removed from the Scenarios page. Before canceling an execution plan, check whether it has been referenced by a scheduled O&M scenario. If yes, delete the referenced scenario first.

  1. In the navigation pane, choose Jobs. Then, locate the desired job, and click View Execution Plan in the Operation column. On the displayed page, locate the desired plan and click Unpublish in the Operation column.

    Figure 11 Canceling a published plan

  2. In the displayed dialog box, click Yes to cancel a published plan.

More Operations

After a job is created, you can click the job name to go to its details page and view the basic information, global parameters, and steps of the job. You can also perform the operations listed in Table 7.

Table 7 Related operations

Operation

Description

Modifying a job

Click Modify in the upper right corner to modify a job.

NOTE:

To use the modified job, you need to create an execution plan.

Selecting a plan

Click Select Plan in the upper right corner.

Deleting a job

Click Delete in the upper right corner.

Modifying a plan

Locate the target execution plan and click Modify.

Before modifying a plan, check whether the plan has been referenced by a scheduled O&M scenario. If yes, delete the referenced scenario first.

Deleting a plan

Locate the target execution plan and click Delete.

Before deleting a plan, check whether the plan has been referenced by a scheduled O&M scenario. If yes, delete the referenced scenario first.