Task 如何在一个作业中在两个节点上运行不同的任务

Task 如何在一个作业中在两个节点上运行不同的任务,task,host,rundeck,Task,Host,Rundeck,我需要在一个作业中的两个节点上运行不同的作业。 #!/bin/bash #Create the following folders: mkdir -p /shared_folder/files/Source mkdir -p /shared_folder/files/Target #Generate the backups #Under Source execute the following command: cp -r /local/folder /shared_folder/files

我需要在一个作业中的两个节点上运行不同的作业。 #!/bin/bash

#Create the following folders:
mkdir -p /shared_folder/files/Source
mkdir -p /shared_folder/files/Target


#Generate the backups
#Under Source execute the following command:
cp -r /local/folder /shared_folder/files/Source

#Under Target execute the following command:
cp -r /local/folder /shared_folder/files/Target

#Delete all Target mobile configurations:
#Under Target execute the following command:
rm /local/folder/*.*

#Copy the mobile configurations from Source to Target:
#Under Target execute the following command:
cp  /shared_folder/files/Source/*.* /local/folder/

Restart Tomcat Service in Target:
Under Target execute the following command:
/sbin/service tomcat restart
下面是我的引用作业,它使用${option.NodeFilter1}和${option.NodeFilter2}将节点名传递给实际的2个作业

我不知道我是否必须在本地运行此参考作业,并且这两个实际作业将推送到机器上,或者此参考作业也应推送到实际机器上

After suggestion I've created this job reference. It references 2 actual jobs.
- id: 98e41ff6-93e3-455a-9744-29bb6e8aae27
  project: SecureCloud
  loglevel: INFO
  sequence:
    keepgoing: false
    strategy: node-first
    commands:
    - jobref:
        group: apps
        name: Synchronize mobile configurations Source
        args: -Nodefilter1 ${option.NodeFilter1}
        nodeStep: 'true'
        nodefilters:
          filter: ${option.NodeFilter1}
      description: Source
    - jobref:
        group: apps
        name: Synchronize mobile configurations Destination
        args: -NodeFilter2 ${option.NodeFilter2}
        nodeStep: 'true'
        nodefilters:
         filter: ${option.NodeFilter2}
      description: Destination
  description: ''
  name: Synchronize mobile configurations Master
  uuid: 98e41ff6-93e3-455a-9744-29bb6e8aae27
  group: apps
 options:
    NodeFilter1:
      required: true
    NodeFilter2:
      required: true
这是两种实际工作之一

- id: 47b65475-f14b-4e5e-8d4f-aa9bb3c8e2b6
  project: SecureCloud
  loglevel: INFO
  sequence:
    keepgoing: false
    strategy: node-first
    commands:
    - script: |
        #!/bin/bash

        touch /home/user/source-@option.NodeFilter1@



      scriptInterpreter: sudo
      interpreterArgsQuoted: false
  description: Synchronize mobile configurations
  name: Synchronize mobile configurations Source
  uuid: 47b65475-f14b-4e5e-8d4f-aa9bb3c8e2b6
  nodefilters:
    dispatch:
      threadcount: 2
      keepgoing: true
      excludePrecedence: false
      rankOrder: ascending
    filter: ${option.NodeFilter1}
  group: apps
  options:
    NodeFilter1:
      required: true
      description: Source Node
我在尝试运行此配置时遇到此错误:

选项输入对[apps/Synchronize mobile Configuration Source]无效:需要选项“NodeFilter1”。
13:50:58执行失败:637:[工作流结果:,步骤失败:{1=在1个节点上调度失败:[c000lrdp01na01.na01.mstrci.com:无效选项:无效选项:[NodeFilter1]]},节点失败:{c000lrdp01na01.na01.mstrci.com=[无效选项:无效选项:[NodeFilter1]],流控制:继续,状态:失败

您可以创建两个作业,每个作业在单独的节点上执行相应的任务。然后创建另一个作业,该作业通过作业引用功能执行这两个作业。确保不要在第三个作业中设置节点筛选器。

我可以通过此引用传递从nodefilter获取的NodeName吗这两个作业的作业?我之所以这样问,是因为它将在其上运行的这些节点将发生更改。我已创建了此引用作业。请确保大小写正确,我在第一个作业参考中看到您有
args:-Nodefilter1${option.Nodefilter1}
,但您的选项名为
Nodefilter1
F
不是
F