Rundeck 作业退出代码

问题描述 投票:0回答:1

我正在尝试在 rundeck 中通过多个步骤执行内核补丁。当所有服务器都打补丁时,它工作得非常好。 现在我添加了第一步来检查服务器是否已经在版本中并退出 1 ,但这似乎使其他作业等待并最终未启动,并且其他服务器的一些作业也未启动。 如何使第一步失败的服务器作业停止。

jobs rundeck
1个回答
0
投票

问题在于策略行为。对于您的情况,一个好的方法是将策略保持为“节点优先”并设置“在失败的步骤处停止”。在“如果步骤失败:”部分。

查看此职位定义示例:

- defaultTab: nodes
  description: ''
  executionEnabled: true
  id: afe23179-1a3b-4d57-b59d-2a931dc3920d
  loglevel: INFO
  name: PatcherSimulation
  nodeFilterEditable: false
  nodefilters:
    dispatch:
      excludePrecedence: true
      keepgoing: true
      rankOrder: ascending
      successOnEmptyNodeFilter: false
      threadcount: '1'
    filter: node.*
  nodesSelectedByDefault: true
  plugins:
    ExecutionLifecycle: {}
  scheduleEnabled: true
  sequence:
    commands:
    - configuration:
        adhocRemoteString: sleep 5; cat myfile.txt
      nodeStep: true
      type: exec-command
    - configuration:
        adhocRemoteString: sleep 5; echo "step 2"
      nodeStep: true
      type: exec-command
    - configuration:
        adhocRemoteString: sleep 5; echo "step 3"
      nodeStep: true
      type: exec-command
    keepgoing: false
    strategy: node-first
  uuid: afe23179-1a3b-4d57-b59d-2a931dc3920d

如果第一个节点上的步骤 1 失败,则仅停止第一个节点中的作业,但仍继续处理其余节点。

查看结果这里

现在,如果您想在节点上并行运行此作业(当然具有相同的行为),请转到“节点”选项卡并在“线程计数”文本字段中设置节点数。

© www.soinside.com 2019 - 2024. All rights reserved.