我可以使用以下 Postman POST 请求来启动 Netscaler 固件升级。
POST: http://192.168.1.10/nitro/v1/config/install?warning=yes
Headers: Content-Type: application/vnd.com.citrix.netscaler.install+json
Body (JSON):
{
"install":{
"url":"file:///var/nsinstall/build-13.0-41.20_nc_64/build-13.0-41.20_nc_64.tgz",
"y":true,
"l":false
}
}
我现在正在尝试使用 Ansible 做同样的事情。下面是 Ansible 中的一个 playbook 示例,它不起作用。查看数据包捕获,Ansible 似乎没有发送格式正确的 HTTP 请求。
---
- hosts: ns
gather_facts: false
tasks:
- name: get ns config
register: ps
uri:
url: http://192.168.1.10/nitro/v1/config/install
method: POST
return_content: yes
headers:
X-NITRO-USER: nsroot
X-NITRO-PASS: nsroot
body:
install:
url: "file:///var/nsinstall/12.1-54.13_nc/build-12.1-54.13_nc_64.tgz"
y: true
l: false
- name:
debug: var=ps
输出
**"msg": "Status code was not [200]: An unknown error occurred: must be string or buffer, not dict",**
你会怎么做呢?
谢谢你的帮助。