Rundeck job exit codes

93 views Asked by At

I’m trying to perform kernel patches with multiple steps in rundeck. It is working perfectly fine when all the servers to be patched . Now I added the first step to check if the server is already in the version and exit 1 but it seems makes the other jobs waiting and finally not started and some of the jobs for other servers also not started . How to make the jobs to stop for the server failed with first step .

1

There are 1 answers

4
MegaDrive68k On

The problem there is the strategy behavior. In your case, a good approach is to keep the strategy as "Node First" and set "Stop at the failed step." on the "If a step fails:" section.

Check this job definition example:

- 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

If step 1 on the first node fails, stop the job only in the first node, but still work on the rest.

Check the result here.

Now, if you want to run this job parallelly across your nodes (with the same behavior of course), go to the "Nodes" tab and set the number of nodes in the "Thread Count" text field.