0

I'm able to use the following Postman POST request to initiate a Netscaler firmware upgrade.

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
    }
}

I'm now trying to do the same using Ansible. Below is an example of a playbook in Ansible, which didn't work. Looking at a packet capture, it doesn't look like a properly formatted HTTP request gets sent by Ansible.

---
- 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

Output

**"msg": "Status code was not [200]: An unknown error occurred: must be string or buffer, not dict",**

How would you go about doing this?

Thanks for any help.

warnox
  • 33
  • 8

1 Answers1

1

It looks like the only issue with the above was the missing 'body_format' line.

...
body_format: json
...
warnox
  • 33
  • 8