You can configure a Git repository for each project and store Rundeck jobs in the repository. The following extract is an example of a Rundeck job that you can define in the Git repository for importing:
- description: Shows uptime of the system.
executionEnabled: true
group: systools
loglevel: INFO
name: uptime
nodeFilterEditable: false
nodefilters:
dispatch:
excludePrecedence: true
keepgoing: true
rankOrder: ascending
threadcount: 1
filter: tags:cicd
nodesSelectedByDefault: true
options:
- enforced: true
name: pretty
values:
- -p
scheduleEnabled: true
sequence:
commands:
- exec: uptime ${option.pretty}
keepgoing: false
pluginConfig:
WorkflowStrategy:
node-first: null
strategy: node-first
This approach has the following limitations:
Changes introduced using the git commit --amend command are not supported.
The name
parameter in job definition files is required.
The value of the name
parameter may differ from the file name and
determines the resulting name of a job.
You can configure not more than one remote repository per project
An incorrect or non-existent branch definition may not result in a Salt configuration error leading to an empty job list.
The Salt state may not recover jobs if you have specified the branch incorrectly. For example, if the jobs are lost due to the incorrect branch definition, the synchronization of jobs may be lost even if the correct branch is defined later and the Salt state is restarted.
To configure job importing for a project:
To use a remote repository as a source of jobs, extend the project’s
metadata as required. A minimal configuration includes the address
parameter for the import
plugin:
parameters:
rundeck:
client:
project:
test_project:
plugin:
import:
address: https://github.com/path/to/repo.git
A complete list of all available parameters for the import
plugin
includes:
Parameter and default value |
Values |
Description |
---|---|---|
|
String |
A valid Git URL (Required) |
|
String |
The name of a repository branch (Optional) |
|
String preserve , remove , or archive |
The UUID importing mode in job descriptions (Optional) |
|
String yaml or xml |
The extension of files containing job definitions (Optional) |
|
String |
The pattern to recognize job definition files (Optional) |
|
Regex |
The regex that filters jobs for importing (Optional) |
Example of the import
plugin configuration with all the available
parameters:
parameters:
rundeck:
client:
project:
test_project:
plugin:
import:
address: https://github.com/akscram/rundeck-jobs.git
branch: master
import_uuid_behavior: remove
format: yaml
path_template: ${job.group}${job.name}.${config.format}
file_pattern: '.*\.yaml'
Apply the Rundeck client state:
salt-call state.sls rundeck.client