Rundeck 4.8.0 - Using options as node filters

286 views
Skip to first unread message

Stephan Higuti

unread,
Nov 7, 2023, 11:13:59 AM11/7/23
to rundeck-discuss
Hello all,

I'm trying to use an option as node filter, so when I choose an option from the dropdown box, that value is used as filter for the nodes:
I have a bunch of nodes tagged with:
app-group1 and app-group2
When selecting option app-group1, I want the node filter to do something like "tags: ${option.Module}" (which would translate to either tags: app-group1 or tags: app-group2), therefore selecting the respective nodes.
This is my job definition:
```
- defaultTab: nodes
  description: |-
    Service start of a module
    developer_operation
  executionEnabled: true
  group: testing
  id: 4f3ec8cb-dcfb-4b37-b1f8-2ce4fab73255
  loglevel: INFO
  name: testing
  nodeFilterEditable: false
  nodefilters:
    dispatch:
      excludePrecedence: true
      keepgoing: false
      rankOrder: ascending
      successOnEmptyNodeFilter: true
      threadcount: '1'
    filter: 'tags: ${option.Module}'
  nodesSelectedByDefault: true
  options:
  - enforced: true
    name: Module
    required: true
    values:
    - app-group1
    - app-group2
    valuesListDelimiter: ','
  plugins:
    ExecutionLifecycle: null
  retry: '1'
  scheduleEnabled: true
  sequence:
    commands:
    - exec: hostname
    keepgoing: false
    strategy: node-first
  uuid: 4f3ec8cb-dcfb-4b37-b1f8-2ce4fab73255
```

This does not work. Is there any other way of doing it?
Thank you,

Stephan

rac...@rundeck.com

unread,
Nov 7, 2023, 11:32:02 AM11/7/23
to rundeck-discuss

Hi Stephan,

I tried your job successfully (it works), which rundeck version are you using? I tested on Rundeck 4.17.1. Could you test on that version? What error are you seeing?

- defaultTab: nodes description: |- Service start of a module developer_operation executionEnabled: true group: testing id: 4f3ec8cb-dcfb-4b37-b1f8-2ce4fab73255 loglevel: INFO name: testing nodeFilterEditable: false nodefilters: dispatch: excludePrecedence: true keepgoing: false rankOrder: ascending successOnEmptyNodeFilter: true threadcount: '1' filter: 'tags: ${option.Module}' nodesSelectedByDefault: true options: - enforced: true name: Module required: true values: - app-group1 - app-group2 valuesListDelimiter: ',' plugins: ExecutionLifecycle: null retry: '1' scheduleEnabled: true sequence: commands: - exec: hostname keepgoing: false strategy: node-first uuid: 4f3ec8cb-dcfb-4b37-b1f8-2ce4fab73255

Regards.

rac...@rundeck.com

unread,
Nov 7, 2023, 11:33:55 AM11/7/23
to rundeck-discuss

I used the following mock remote nodes btw:

<?xml version="1.0" encoding="UTF-8"?> <project> <node name="node00" description="Node 00" tags="app-group1" hostname="192.168.56.20" osArch="amd64" osFamily="unix" osName="Linux" osVersion="5.14.0-284.30.1.el9_2.x86_64" username="vagrant" /> <node name="node01" description="Node 01" tags="app-group2" hostname="192.168.56.21" osArch="amd64" osFamily="unix" osName="Linux" osVersion="5.14.0-284.30.1.el9_2.x86_64" username="vagrant" /> <node name="node02" description="Node 02" tags="app-group2" hostname="192.168.56.22" osArch="amd64" osFamily="unix" osName="Linux" osVersion="5.14.0-284.30.1.el9_2.x86_64" username="vagrant" /> </project>

Stephan Higuti

unread,
Nov 7, 2023, 4:48:08 PM11/7/23
to rundeck-discuss
Hey! Thanks for the help!
So, I'm sitting on Rundeck 4.8.0. I cant test on a newer version, I mean I could but then rundeck is not our domain here so I'll rely on other team to actually upgrade it... meaning it may never happen.   :(
I don't get any error, it just does not show the nodes when I select the option, but If I override the filter and set the same value as option would provide, then it works.
Am I doing this right? 

Best Regards,
Stephan

rac...@rundeck.com

unread,
Nov 7, 2023, 5:00:43 PM11/7/23
to rundeck-discuss
Hi Stephan,

I see, that's expected because the rundeck GUI needs the explicit names/tags to show the nodes matched before the execution. The value of that option is only available during the execution. Basically, for the Rundeck GUI, the option content is only valid during the execution.

Regards.

Stephan Higuti

unread,
Nov 8, 2023, 10:16:10 AM11/8/23
to rundeck-discuss
Oh, you are correct. 
It is indeed working. /Facepalm

Many thanks.
Reply all
Reply to author
Forward
0 new messages