Reputation: 72
I would like to allow anyone to trigger a job I've created in Rundeck. I can't understand from the API documentation how to do that.
Any one knows, and can give simple examples (my understanding of the subject is minimal to none)?
What I've found is of the sort: POST /api/1/job/[ID]/run
Upvotes: 3
Views: 14224
Reputation: 489
To update the answer above, this is an example of running a job and feeding it arguments
You will need to replace hostname/API version/job UID/token
Also the current version can be used with JSON only
curl -X POST https://rundeck-hostname.com/api/41/job/7087d3b7-e454-4983-abd5-a211d21d6f27/run?authtoken=[redacted] -H "Accept: application/json" -H "Content-Type: application/json" -d '{
"options": {
"optionName":"optionValue",
}
}
'
And if you need additional arguments for running a job you can find the updated documentation at https://docs.rundeck.com/docs/api/rundeck-api.html#running-a-job
Upvotes: 1
Reputation: 938
In order to use the Rundeck API, you need to authenticate first. Authentication can be done in two different ways:
Here is an example of running a Rundeck job using its API (Token based authentication)
curl -X POST http://rundeck_server:port/api/19/job/87bdc26ce-9893-49bd-ad7a-97f4c4a39196/run?authtoken=AVy8jZdcpTYOyPcOVbfcfOQmB6b92zRu --header "Content-Type:text/xml"
Explanation:
19
: the API version or Rundeck installation version (19 matchs
Rundeck 2.8.2)87bdc26ce-9893-49bd-ad7a-97f4c4a39196
: Job UUIDrun
: Runs a jobPS: To obtain an API Token, you must first log in to the Rundeck GUI using a user account. Click on your username in the header of the page, and you will be shown your User Profile page. From this page you can manage your API Tokens.
Upvotes: 6