How to manage batch task execution on large-scale servers?

Published 2024年11月06日

Scenario Description

In large-scale operations management scenarios, system administrators may need to execute the same configuration updates or security patches across multiple Linux servers. However, manually performing these operations one by one is not only time-consuming but also prone to errors. To address this scenario, JumpServer offers the JOB CENTER feature, which allows for batch execution of tasks and records the execution results. This enables administrators to operate on multiple servers simultaneously through a unified management interface, thereby improving efficiency and consistency.

Function Description

The JOB CENTER module in JumpServer is an automation module designed for executing batch commands or tasks on assets. It includes features such as Adhoc, Jobs, Templates, and Executions. Assets using the Job Center module must support the SSH protocol, and it is recommended that the concurrency of each task does not exceed 50 to ensure stable operation of the JumpServer system and other automation tasks.

Operation Instructions

We can manually execute commands in bulk, or support custom command/job templates to execute tasks manually or on a scheduled basis.

Command Execution

Switch to the JumpServer Workbench page and select the JOB CENTER's Adhoc module.

  1. In the left-hand side <Asset tree>, select the target assets where the command needs to be executed in bulk.

  2. In the <Run user> section, choose the account that will execute the command on the target assets.

  3. Configure the command matching rules in the <Account policy> and <Module> sections.The Module options include Shell, Powershell, Raw, Python, MySQL, Postgresql, SQLServer, and CloudEngine, which can be selected based on your requirements.

  4. Enter the command to be executed in bulk in the command line field.

  5. Click <Run> to start executing the task.

  6. View the task results.

Template Task Execution

You can create Script or Playbook templates in the Templates section. In this example, we will create a script for a playbook that pings a host.

Switch to the Jobs module, create a Playbook job, and fill in the relevant information, such as the target assets for executing the playbook script, the running user, and whether to enable a scheduled task.

Select the Playbook job, choose <Execute> in the Actions field, and you will see the Task log, which contains the execution results.

Execution history

Switch to the Executions page, where we can see the execution history of all tasks.