Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST Api feature #19

Closed
cdloh opened this issue Apr 9, 2015 · 8 comments
Closed

REST Api feature #19

cdloh opened this issue Apr 9, 2015 · 8 comments
Milestone

Comments

@cdloh
Copy link

cdloh commented Apr 9, 2015

I've been playing with semaphore for a while now. Good alternative if Ansible Tower isn't an option.

One feature that I'd like to see is a REST API so that it would be possible to fire off playbooks via an API. Would this be possible / been looked at?

Cheers.

@matejkramny
Copy link
Contributor

There is a JSON api already written which the frontend code uses.

The authentication mechanism would need to change to allow scripts easier access. For the short-term, you could use the Cookie header as authentication.

Better API access will definitely be looked at (0-2 weeks?).

Endpoint that starts a job: /lib/routes/task/tasks.js#L60

Try this with curl:

curl -X POST \
 -vvv \
 -H "Content-Type: application/json" \
 -H "Cookie: (steal it from your browser)" \
 {semaphore-domain}/playbook/your-playbook-id/job/your-job-id/run

@dbryant4
Copy link

+1

Is there a way that basic token authentication can be implemented?

@matejkramny
Copy link
Contributor

Yeah instead of using cookies it could accept an Authorization header or similar. Its not extremely complicated, neither would it take a long time to do so i'll add that for the next release.

What will take some time is API documentation :). I suppose we'll start a wiki for that.

@dbryant4
Copy link

Is there anything I can do to help? I haven't created a nodejs app before but I can write documentation :)

@matejkramny
Copy link
Contributor

You already did. Nudge me to do this :P

@matejkramny
Copy link
Contributor

I'll let you know once it works and we can collaborate on the documentation. Thanks for offering

@kiranos
Copy link

kiranos commented Oct 1, 2015

This would be very nice, an additional function that would be great if it worked is:
To get back the id of the run we trigger with the API so we could check for:

  • ability to request status while a play runs.
  • get status code when its completed (to know if it failed or ended ok)

@matejkramny matejkramny modified the milestone: v0.3.0 Oct 9, 2015
@matejkramny matejkramny mentioned this issue Mar 28, 2016
21 tasks
@matejkramny
Copy link
Contributor

V2 documentation here: https://ansible-semaphore.github.io/semaphore

V2-alpha can be downloaded from the releases page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants