Hi all.

I'm having a problem with the URI module: in two different servers, with different ansible versions, I get different output from the same uri call. I'm taking some code from the uri module docs themselves, like this:

```yaml
- name: create authentication cookie
  uri:
    url: "{{ non_public_host }}/stuff"
    validate_certs: no
    user: "{{ user }}"
    password: "{{ pass }}"
    method: GET
    headers:
      Accept: "application/stuff+json"
  register: login

# and then we use later the login fact, this way:

- name: get stuff
  uri:
    url: "{{ non_public_host }}/stuff/list"
    validate_certs: no
    method: GET
    return_content: yes
    headers:
      Cookie: "{{ login.set_cookie }}"
  register: stuff_list

```

It's working so far, for about 2y. But when we installed a new server recently, we found the output pasted below. There's a difference in the cookies handling. v2.4 gives us the "cookies" property, while v2.3 returns "set_cookie".


```
# This is the output with ansible 2.4, with some strings edited for privacy reasons:
TASK [roles/stuff : debugging login] ****************************************
ok: [127.0.0.1] => {
    "msg": {
       "cache_control": "max-age=0, private, must-revalidate",
       "changed": false,
       "connection": "close",
       "content_type": "application/stuff+json; charset=utf-8",
       "cookies": {
           "JSESSIONID": "ui74vbyaobr68mj22nmr8ggl"
       },
       "date": "Tue, 15 May 2018 15:01:53 GMT",
       "etag": "\"7a9c36bb30d647628294fb324a7c0e1f\"",
       "failed": false,
       "msg": "OK (unknown bytes)",
       "redirected": false,
       "status": 200,
       "url": "https://non-public-url/stuff";,
       "vary": "Accept-Encoding, User-Agent",
       "x_content_type_options": "nosniff",
       "x_frame_options": "SAMEORIGIN",
       "x_request_id": "62f27c01-aa91-4bd8-8979-05430a1c38c4",
       "x_runtime": "0.020000",
       "x_ua_compatible": "chrome=1",
       "x_xss_protection": "1; mode=block"
   }
}

# This is the output with ansible 2.3, using the same role with the same url:
TASK [roles/stuff : debugging login] ****************************************
ok: [localhost] => {
   "msg": {
       "cache_control": "max-age=0, private, must-revalidate",
       "changed": false,
       "connection": "close",
       "content_type": "application/stuff+json; charset=utf-8",
       "date": "Tue, 15 May 2018 15:05:17 GMT",
       "etag": "\"5ce7ca165672c9ac77e47d0c3617abb2\"",
       "expires": "Thu, 01 Jan 1970 00:00:00 GMT",
       "msg": "OK (unknown bytes)",
       "redirected": false,
"set_cookie": "JSESSIONID=q5z2ud6gpvkh1cw3x6g5wf3ku;Path=/go;Expires=Tue, 29-May-2018 15:05:19 GMT;Secure;HttpOnly",
       "status": 200,
       "url": "https://non-public-url/stuff";,
       "vary": "Accept-Encoding, User-Agent",
       "x_content_type_options": "nosniff",
       "x_frame_options": "SAMEORIGIN",
       "x_request_id": "105e228f-b356-4bc6-87dd-37c459dc008a",
       "x_runtime": "0.025000",
       "x_ua_compatible": "chrome=1",
       "x_xss_protection": "1; mode=block"
   }
}
```

I don't think this is a bug, but more like some kind of config somewhere. But neither the docs or anywhere online seems to point to any such direction like "config THIS like THIS in order to handle cookies THIS way". I didn't found it at least.

I don't want to handle this with ad-hoc checks: I would like to force always the same output from URI.
Any clue on how can I handle this?

Thanks in advance.


--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20180515162417.Horde.kpvGfqtm1jXRE5MAHUFzbog%40first.brohost.com.ar.
For more options, visit https://groups.google.com/d/optout.

Reply via email to