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: task name (after version 0.1.2, exclude 0.1.2)
  • m: command / script
  • a: your shell command / your script path
  • t: host you wanna to run at, ex: all / 127.0.0.1 / 192.168.1.1,192.168.1.2
  • s: sign string for this request = md5(n+m+t+key) (key can be defined at sign_key)
  • r: exec shell/script as root (optional, default:False)
  • c: 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: playbook name [string] (will cover the name in yml file. after version 0.1.2, exclude 0.1.2)
  • h: host you wanna to run at, ex: all / 127.0.0.1 / 192.168.1.1,192.168.1.2
  • f: playbook file name (*.yml)
  • s: sign string for this request = md5(n+h+f+key) (key can be defined at sign_key)
  • c: the number of concurrence (optional, default value is 50.)

post data sample:

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

Clone this wiki locally