Choosing a Random node

15 views
Skip to first unread message

Roger McCarrick

unread,
Jul 25, 2025, 10:26:29 AMJul 25
to rundeck-discuss
Rundeck 4.15.0

I have 2 windows nodes. My Rundeck calls Powershell scripts on one node.
If the node goes down, a DNS switch then points to the other node.

I want to make them active/active.
Is there a way that I can configure the nodes in Rundeck so that when a job runs, it randomly chooses one of the nodes? I do not want the script to run on both nodes. Just one or the other.

And also, is there a way in an API call I can then specifically target a node?
I have a job that takes a CSV file, that job then calls the Rundeck API for each line in the file to schedule a job, if there are 20 lines, I want to schedule 10 jobs on one node and 10 on the other.

rac...@rundeck.com

unread,
Jul 25, 2025, 1:15:53 PMJul 25
to rundeck-discuss

Hi Roger,

To configure your job for random node selection, go to the Nodes section and use the node filter to select both nodes (or use regex to match both). Then scroll down to the Orchestrator section, select "Random subset," and enter "1" in the "Count" field before saving your changes.

Your job will now be dispatched to a single random node from your selected set.

Best regards.


Roger McCarrick

unread,
Jul 25, 2025, 5:52:10 PMJul 25
to rundeck-discuss
Thanks .. that seems to work.

I got my API calls working too ...
Under the Nodes tab I have "Editable filter" YES.

for the JSON body of the API call I have 

{
  "filter": "name:TXNODE",
  "argString": "-clientCode ABC -vmname DC01 -site TX",
  "runAtTime": "2025-07-25T16:27:00-0400"
}

or

{
  "filter": "tags:NY",
  "argString": "-clientCode ABC -vmname DC02 -site NY",
  "runAtTime": "2025-07-25T16:27:00-0400"
}

thanks
Reply all
Reply to author
Forward
0 new messages