ResourceModelSource (javadoc) service allows the plugins to be configured via the Rundeck Web GUI. You are thus able to declare configuration properties for your plugin, which will be displayed as a web form when the Project is configured, or can be manually configured in the
A ResourceModelSource provider is actually a Factory class. An instance of your ResourceModelSource provider will be re-used, so each time a new ResourceModelSource with a new configuration is required, your Factory class will be invoked to produce it.
Your provider class must implement the interface ResourceModelSourceFactory:
See Plugin Development - Java Plugins - Descriptions to learn how to create configuration properties for your ResourceModelSource plugin.
See the Script Plugin Development for the basics of developing script-based plugins for Rundeck.
Instance scoped properties for ResourceModelSources are loaded from the project’s Resource Model Source entries. A project can define multiple entries, and at execution time, the Instance scoped values come from those entries.
Here is an example
plugin.yaml script-based ResourceModelSource plugin declaring a provider called “mysource” that produces resource-format
resourceyaml output. The provider declares three config properties (account, url, region) and illustrates the use of three different types (Integer, String, FreeSelect).
name: My Resource Model Source version: 1.0 rundeckPluginVersion: 1.0 author: alexh date: 05/10/12 providers: - name: mysource service: ResourceModelSource plugin-type: script script-interpreter: bash -c script-file: nodes.sh resource-format: resourceyaml config: - type: Integer name: account title: Account description: Enter the account number. - type: String name: url title: URL description: Enter the URL to the inventory service. - type: FreeSelect name: region title: Region description: Select a region. required: true default: east values: east,north,south,west
script-file entry on line 11 references a script called “nodes.sh” referencing the plugin properties (see script below).
Example script-file: nodes.sh
The ResourceModelSource service has expectations about the way your provider script behaves.
STDOUTwill be captured and passed to a ResourceFormatParser for the specified
resource-formatto create the Node definitions.