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" https://your-rundeck-server.com/api/26/projects | jq `

list jobs inside projects

curl -k -X "GET" -H "Accept: application/json" -H "X-Rundeck-Auth-Token: YOUR-TOKEN-HERE" https://your-rundeck-server.com/api/26/project/[project-name]/jobs | jq .

execute a job

curl -k -X "POST" -H "Accept: application/json" -H "X-Rundeck-Auth-Token: YOUR-TOKEN-HERE" https://your-rundeck-server.com/api/26/job/[job-id]/run | jq .

get a job result

curl -k -X "GET" -H "Accept: application/json" -H "X-Rundeck-Auth-Token: YOUR-TOKEN-HERE" https://your-rundeck-server.com/api/26/execution/[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]" https://your-rundeck-server.com/api/26/job/[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]" https://your-rundeck-server.com/api/26/job/[job-id]/run | jq .