以下是我的剧本,其中包含 Rest Call
---
-
name: "REST CALL"
hosts: local
tasks:
- name: "REST Call to Get Session ID"
uri:
url: http://192.168.96.172:5300/avxapi/acctmgmt-perform-login?gwkey=f000ca01&gwsource=web
method: POST
body: "{{ lookup('file','empty.json') }}"
body_format: json
return_content: yes
headers:
Content-Type: "application/json"
username: "admin"
password: "Apptest@123"
register: login
- debug:
var: "{{ login }}"
这是我的回应
PLAY [REST CALL] *********************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [REST Call to Get Session ID] *********************************************
ok: [localhost]
TASK [debug] *******************************************************************
ok: [localhost] => {
"<type 'dict'>": "VARIABLE IS NOT DEFINED!"
}
有人能找到为什么我没有得到正确的响应吗?顺便说一句,主体只包含一个空的有效负载。empty.json 看起来像这样
{"payload":{}}