Eduardo Medeiros

Eduardo Medeiros

System Engineer.

© 2022

About me

Browse by categories

Rundeck: managing the api

Rundeck api

Rundeck is an open-source automation service with a web console and command-line tools.

In addition, what is nice about Rundeck is that you are able to manage it via API, which is super nice for integration with other systems eg: Jenkins and so.

Follow some examples about how to use the Rundeck API.

list projects

curl -k -X "GET" -H "Accept: application/json" -H "X-Rundeck-Auth-Token: YOUR-TOKEN-HERE" | jq `

list jobs inside projects

curl -k -X "GET" -H "Accept: application/json" -H "X-Rundeck-Auth-Token: YOUR-TOKEN-HERE"[project-name]/jobs | jq .

execute a job

curl -k -X "POST" -H "Accept: application/json" -H "X-Rundeck-Auth-Token: YOUR-TOKEN-HERE"[job-id]/run | jq .

get a job result

curl -k -X "GET" -H "Accept: application/json" -H "X-Rundeck-Auth-Token: YOUR-TOKEN-HERE"[job-execution-id] | jq ".status"

run specific host

Host level:

curl -k -X "POST" -H "Accept: application/json" -H "X-Rundeck-Auth-Token: YOUR-TOKEN-HERE" --data-urlencode "filter=[host]"[job-id]/run | jq .

Tags (for this example test environment)

curl -k -X "POST" -H "Accept: application/json" -H "X-Rundeck-Auth-Token: YOUR-TOKEN-HERE" --data-urlencode "filter=tags:[environment]"[job-id]/run | jq .