OptionValues Plugin

85 views
Skip to first unread message

James F.

unread,
Aug 19, 2024, 8:56:45 AMAug 19
to rundeck-discuss
I have built an OptionValues plugin that will make an LDAP query to return results in a JSON structure. I would like to avoid having separate selections appear in the "Allow Values" section based on the many different queries I am going to conduct (Users, OUs, Groups, Computer objects, etc.).

What values are available to me that will allow me to further filter my OptionValues results? As an example, I have tried setting another job option variable userStatus to either Enabled or Disabled. I wanted my OptionsValues plugin to read that value and disaply either a list of enabled or disabled AD users. It seems I do not have access to the other defined job options on page load. By using the lifecycle plugins, I can get access to the values either at job save or prior to job execution (Which is not useful to me in this context).

I would be fine with filtering off of job-name and hard-coding a few if statements, I just do not know how to access that data within my Java plugin.

Any help?

James F.

unread,
Aug 19, 2024, 9:39:43 AMAug 19
to rundeck-discuss
I am also trying to use Plugin Groups on a Resource Model Source. The idea is that a user would define the configurations in the resource model factory, and those configuration items would be part of a group. Where can I get a good example of how to implement this? 

rac...@rundeck.com

unread,
Aug 19, 2024, 1:34:01 PMAug 19
to rundeck-discuss
Hi James,

Are you looking for a multi-level option capability? Could you take a look at this?

Regards.

James F.

unread,
Aug 19, 2024, 2:51:47 PMAug 19
to rundeck-discuss
A few things:

  1. Overall, I have a ResourceModelSource plugin that takes input such as: LDAPUsername, LDAPPassword, AdminUsername, AdminPassword. The configuration is defined when the imported plugin is added as a node source. I am setting custom node tags/attributes to ensure appropraite WinRM/SSH settings are defined to override the default node executor options. This allows me to have a dynamic node inventory integrated with an AD source.
  2. I want to use the configurations defined in the step above to feed a custom options plugin. I only care about the LDAP relevant configuration items. I have a need to feed a dynamic list of options for: Enabled users, disabled users, existing AD groups, existing computer objects, etc. These options will feed different jobs. 
    1. I want a "Disable Users" job that will render a list of currently active AD users and allow someone to multi-select accounts they want to disable
    2. I want a separate "Enable users" job that will render a list of currently inactive AD user accounts and allow someone to multi-select accounts they want to enable.
    3. The above are just basic examples of how I want to re-use the LDAP connection configuration to feed subsequent job options
  3. I have looked into cascading JSON and followed the examples on the Rundeck site explicitly. The cascading/nested JSON options is something we have never gotten to work since Rundeck 4.X to 5.4
  4. I attempted to define a 'PluginGroup' but the 'ResourceModelSourceFactory' and 'ResourceModelSource' classes do not compile if I attempt to add  ", ConfiguredBy<MyPluginGroup" to the declaration of my node source plugins
    1. I have instead implemented a Singleton object that pulls the configuration from the NodeSource and defines a common 'configuration' for a subsequent 'LDAP Options' plugin
    2. I have attempted to allow my  'LDAP Options' plugin to filter it's LDAP query based on other attributes such as: Job Name, other option names defined within the job context, etc.
      1. The only way I have gotten my existing logic to work is by creating a lifecycle plugin that allows me to define the 'userStatus' option as "Enabled or Disabled." On job save, I can query that option.userStatus value as an input to "LDAP Option" plugin and filter the query. This is not ideal, as I do not want to have to save (or  define the lifecycle plugin to run prior to execution).

Thanks!

rac...@rundeck.com

unread,
Aug 20, 2024, 1:17:51 PMAug 20
to rundeck-discuss

Hi,

Regarding this:

I have looked into cascading JSON and followed the examples on the Rundeck site explicitly. The cascading/nested JSON options is something we have never gotten to work since Rundeck 4.X to 5.4

Weird, it works following this. If this approach works in your environment, would achieve your goal?

Greetings.

James F.

unread,
Aug 20, 2024, 1:22:53 PMAug 20
to rundeck-discuss
I misspoke - this works: /home/user/${option.parent.value}, but I am not using a URL source for my option any more (Using my custom LDAP Option Plugin to avoid static files served up).

James F.

unread,
Aug 24, 2024, 11:23:15 PMAug 24
to rundeck-discuss
Let me re-word my question:

If I create a custom OptionsValues plugin, do I have the ability to access any of the 'event' object properties? I want to take my Optionvalues plugin and change the 'output' based on the current job properties....

rac...@rundeck.com

unread,
Aug 26, 2024, 12:51:48 PMAug 26
to rundeck-discuss
Hi James,

Thanks for the clarification. In that context, what do you mean by "current job properties"?

Greetings!

Reply all
Reply to author
Forward
0 new messages