Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gambol99/rundeck-api

Rundeck API library for ruby
https://github.com/gambol99/rundeck-api

Last synced: 11 days ago
JSON representation

Rundeck API library for ruby

Awesome Lists containing this project

README

        

Rundeck API
===========

A simple api into rundeck - note, this was written quickly ... needs some polish so to speak :-)

$:.unshift File.join(File.dirname(__FILE__),'.','../lib')
require 'rundeck-cli'
require 'optionscrapper'
require 'pp'

@options = {
:rundeck => 'https://rundeck.domain.com',
:api_token => 'token_key',
:project => 'orchestration',
:args => {}
}

api = Rundeck::API.new @options
orchestration = api.project 'orchestration'

orchestration.jobs do |job|
puts "job: #{job.name}"
end

puts "checking for the launch job"
launch = orchestration.job 'delete'
puts "running the launch job"
execution = launch.run :hostname => 'rohith333'
puts "ran the job"
puts "checking the execution status"
execution.waitfor
puts "status"
puts execution.status

Decker
======

Is a command line utility for interacting it rundeck

Usage: ./decker.rb command [options]
-h, --help display this usage menu
-c, --config CONFIG the path / location of the configuration file (/home/jest/.rundeck.yaml)
-r, --rundeck RUNDECK the configuration can contain multiple rundecks

commands : -------------------------------------------------------------
list (ls) list all the jobs with the selected project
exec (r) run / execute a job within the project
activity (his) interrogate the rundeck activity and history
import (imp) import a jobs or jobs into the current project
export (exp) export the jobs from the project in the specified format
------------------------------------------------------------------------

list : description: list all the jobs with the selected project
------------------------------------------------------------------------

-n, --name NAME the name of the job you wish to export, regex
-g, --group GROUP list job only within this group, regex

exec : description: run / execute a job within the project
------------------------------------------------------------------------

-n, --name NAME perform an execution of the job
-t, --tail tail the output of the execution and print to screen
-h, --help display the options for this job

activity : description: interrogate the rundeck activity and history
------------------------------------------------------------------------

-n, --name JOB_NAME filter the activity by the job name, regex
-i, --id ID the id of the activity you are interested in
-g, --group GROUP filter the activity by the group name, regex
-R, --running only show activity which is current running
-S, --stopped only show activity which has stopped
-F, --failed only show activity which has failed
-o, --output view the output of the activity or tail the running job

import : description: import a jobs or jobs into the current project
------------------------------------------------------------------------

-j, --jobs JOBS the location of the file contains the job/jobs
-f, --format FORMAT the format the jobs file is in (yaml/xml)
-u, --uuid OPTIONS preserve or remove options for uuids
-r, --remove remove the uuid from jobs, allows updateto succeed (default is true)
-D, --dupe OPTION the behavior when importing jobs which exist (skip/create/update)

export : description: export the jobs from the project in the specified format
------------------------------------------------------------------------

-f, --format FORMAT the format of the jobs, either yaml or xml (defaults to yaml)
-n, --name NAME the name of the job you wish to export
-d, --directory DIRECTORY the directory to place the single jobs
-s, --single export the jobs in single files

The configuration file resembles the following

default: deck0 # if you have multiple and dont specify the -r|--rundeck option, this one will be used
rundecks:
deck0:
rundeck: https://rundeck.deck0.domain.com
api_token: SOME_TOKEN
project: SOME_PROJECT
deck1:
rundeck: https://rundeck.deck1.domain.com
api_token: SOME_TOKEN
project: SOME_PROJECT