-
Notifications
You must be signed in to change notification settings - Fork 57
HTTP API Usage
little flying bear edited this page Jul 31, 2019
·
14 revisions
-
request uri: /command
-
data type: json string
-
method: post
-
post json 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, abandon after 0.3.0)
- c: {int} the number of concurrence (optional, default value is 50, abandon after 0.3.0)
- i: {bool} immediately get response, IT'S asynchronous mode (optional, default:False, abandon after 0.3.0)
-
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}
- request uri: /playbook
- data type: json string
- method: post
- post json 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)
- v_*: {string} custom vars in playbook, "v_" is fixed prefix and * is custom var's name
- c: {int} the number of concurrence (optional, default value is 50, abandon after 0.3.0)
- i: {bool} immediately get response, IT'S asynchronous mode (optional, default:False, abandon after 0.3.0)
- post data sample: {"n":"play#id@project","h":"all","f":"/home/myname/myplaybook.yml","s":"1aa8c17520df23f0479423ff830316acf","c":50}
name's format likes this: intro#id@project, keep this format, you can receive a struct info from webscoket.
--- Ansible-API: Use ansible easily for developer ---