Skip to main content

Open Source Resource Model Source Plugins


Open Source Resource Model Source Plugins

Rundeck includes these Built-in plugins in the core installation:

file
Uses a file on the file system, in any of the supported Resources formats.
url
GETs a URL, and expects one of the supported Resources formats.
directory
looks at all files in a directory for supported file extensions, and internally uses the file provider for each file that matches.
script
Executes a script and parses the output as one of the supported formats

To configure these providers use the following configuration properties.

File Source

The file Resource Model Source provider reads a file in one of the supported Resource Model Document Formats.

NameValueNotes
filefile pathPath to a file on disk.
formatformat nameCan be used to declare the format explicitly. Otherwise the format is determined from the file's extension.
requireFileExiststrue/falseIf true and the file is missing, causes a failure to load the nodes. (Default: false)
includeServerNodetrue/falseIf true, include the Project's server node automatically. (Default: false)
generateFileAutomaticallytrue/falseIf true, create the file automatically if it is missing. (Default: false)

Table: Configuration properties for file Resource Model Source provider

The value of format must be one of the supported Resource Model Document Formats. The built-in formats are: resourcexml or resourceyaml, but any format provided by a Resource Format Plugin can be specified as well.

Example:

Here's a sample XML document that defines a node called "orion":

<project>
  <node name="orion"
    description="a foodazzler service host" tags="staging,us-east"
    osFamily="unix" osName="Linux"
    hostname="orion"  username="alexh"
    />
</project>

The node element has a few required such as name, osFamily and tags.

You can add any number of nodes in this document. Here's a second node called homestar:

<project>
  <node name="orion"
    description="a foodazzler service host" tags="staging,us-east"
    osFamily="unix" osName="Linux"
    hostname="orion"  username="alexh"
    />
  <node name="homestar"
    description="a humdinger" tags="integration,us-west"
    osFamily="unix" hostname="192.168.1.02"  username="alexh">
    <attribute name="flavor" value="medium"/>
    <attribute name="package:version" value="2.0"/>
  </node>
</project>

The hostname and username values are used for the SSH connection while the name and type are used to define Node identity in the resource model. It is possible to overload the hostname value to include port information (eg, hostname="somehost:2022"). This is useful if your run SSH on a different port.

You can also tell there are two different ways to declare an attribute using the XML format. The "flavor" attribute is defined as a separate XML element:

<attribute name="flavor" value="medium"/>


resources.source.1.type=file
resources.source.1.config.file=/home/rundeck/projects/example/etc/resources2.xml
resources.source.1.config.format=resourcexml
resources.source.1.config.requireFileExists=true
resources.source.1.config.includeServerNode=true
resources.source.1.config.generateFileAutomatically=true

URL Source

The url Resource Model Source provider performs a HTTP GET request to retrieve the Nodes definition.

Configuration properties:

NameValueNotes
urlURLA valid URL, either http:, https: or file: protocol.
cachetrue/falseIf true, use ETag/Last-Modified information from the server to only download new content if it has changed. If false, always download the content. (Default: true)
timeoutsecondsNumber of seconds before request fails due to timeout. 0 means no timeout. (Default: 30)

Table: Configuration properties for url Resource Model Source provider

The Resource Model Document Format that is used is determined by the MIME type sent by the remote server. The built-in formats accept "*/xml" and "*/yaml" and "*/x-yaml".

Example:

resources.source.1.type=url
resources.source.1.url=file:/home/rundeck/projects/example/etc/resources2.xml
resources.source.1.cache=true
resources.source.1.timeout=0

Directory Source

The directory Resource Model Source provider lists all files in a directory, and loads each one that has a supported file extension as File Resource Model Source with all default configuration options.

NameValueNotes
directorydirectory pathAll files in the directory that have a supported file extension will be loaded

Example:

resources.source.2.type=directory
resources.source.2.directory=/home/rundeck/projects/example/resources

Script Source

The script Resource Model Source provider executes a script file and reads the output of the script as one of the supported Resource Model Document Formats.

NameValueNotes
fileScript file pathIf required by the interpreter, the file should be executable
interpreterCommand or interpreter to usee.g. "bash -c"
argsAdditional arguments to passThe arguments will be added after the script file name to the executed commandline
formatFormat nameMust be used to declare the format explicitly.

Table: Configuration properties for script Resource Model Source provider

The script will be executed in this way:

[interpreter] file [args]

All output on STDOUT will be passed to a Resource Format Parser to parse. The format specified must be available.

Example:

resources.source.2.type=script
resources.source.2.file=/home/rundeck/projects/example/etc/generate.sh
resources.source.2.interpreter=bash -c
resources.source.2.args=-project example
resources.source.2.format=resourceyaml

Resource Model Document Formats

Resource Model Document Formats are defined by plugins that provide Generators and Parsers, typically in matched pairs, with both a parser and generator for the same format name.

Resource Format Plugins

Rundeck includes three built-in plugins in the core installation:

resourcexml

Supports the Resource XML document format: resource-XML.

Supported MIME types:

  • Generator: text/xml
  • Parser: */xml

Supported File extensions:

  • .xml
resourceyaml

Supports the Resource YAML document format: resource-YAML.

Supported MIME types:

  • Generator: text/yaml, text/x-yaml, application/yaml, application/x-yaml
  • Parser: */yaml, */x-yaml

Supported File extensions:

  • .yml, .yaml
resourcejson

Supports the Resource JSON document format: resource-JSON.

Supported MIME types:

  • Generator: application/json, text/json
  • Parser: application/json, text/json

Supported File extensions:

  • .json