Skip to content

HTTP API Usage

little flying bear edited this page Dec 29, 2016 · 14 revisions

Shell mode

request uri: /command

data type: json string

method: post

post data struct:

  • n: {string} task name (after version 0.1.2, exclude 0.1.2)
  • m: {string} command / script
  • a: {string} your shell command / your script path
  • t: {string} host you wanna to run at, ex: all / 127.0.0.1 / 192.168.1.1,192.168.1.2
  • s: {string} sign string for this request = md5(n+m+t+key) (key can be defined at sign_key)
  • r: {bool} exec shell/script as root (optional, default:False)
  • c: {int} the number of concurrence (optional, default value is 50)

post data sample:

  • shell mode: {"n":"task#id@project","m":"command","a":"df -h","t":"127.0.0.1","s":"1aa8c17520df23f0479423ff830316acf"}
  • script mode: {"n":"task#id@project","m":"script","a":"/home/myname/myscript.sh","t":"all","s":"1aa8c17520df23f0479423ff830316acf","r":"True","c":50}

Playbook mode

request uri: /playbook

data type: json string

method: post

post data struct:

  • n: {string} playbook name (will cover the name in yml file. after version 0.1.2, exclude 0.1.2)
  • h: {string} host you wanna to run at, ex: all / 127.0.0.1 / 192.168.1.1,192.168.1.2
  • f: {string} playbook file name (*.yml)
  • s: {string} sign string for this request = md5(n+h+f+key) (key can be defined at sign_key)
  • c: {int} the number of concurrence (optional, default value is 50.)

post data sample:

{"n":"play#id@project","h":"all","f":"/home/myname/myplaybook.yml","s":"1aa8c17520df23f0479423ff830316acf","c":50}

About name (n) upon

name's format likes this: intro#id@project, keep this format, you can receive a struct info from webscoket.

Clone this wiki locally