phew, thanks Matt! That worked! I would have never guessed dest would 
affect redirects!

On Thursday, 6 June 2019 11:08:38 UTC-4, Matt Martz wrote:
>
> The issue seems to be with your use of `dest: .`
>
> If you use something more explicit, like `dest: "{{ playbook_dir }}"` then 
> it will not happen.
>
> I am working on some changes that should hopefully at some future time 
> address the issue you are experiencing: 
> https://github.com/ansible/ansible/pull/50771
>
> On Thu, Jun 6, 2019 at 9:50 AM Sam <[email protected] <javascript:>> wrote:
>
>> ansible 2.8.0
>>
>> Running uri module as
>>
>>     uri:
>>       dest: .
>>       url: https://{{  hostvars[inventory_hostname].ansible_host }}:{{ 
>> apache.port }}/context-root/some-context
>>       validate_certs: false
>>       return_content: true
>>       follow_redirects: none
>>       status_code:
>>         - 302
>>     register: page
>>     changed_when: false
>>     delegate_to: localhost
>>
>> This results in a 302 with the Location header set to a "relative" url. 
>> Ansible follows the 302, ignoring the follow_redirects setting, and fails 
>> on the relative URL with the message
>>
>>     "msg": "unknown url type: /cas/login?service=something"
>> The full traceback is:
>> WARNING: The below traceback may *not* be related to the actual failure.
>>   File 
>> "/tmp/ansible_uri_payload__lMgyr/ansible_uri_payload.zip/ansible/module_utils/urls.py",
>>  
>> line 1353, in fetch_url
>>     unix_socket=unix_socket)
>>   File 
>> "/tmp/ansible_uri_payload__lMgyr/ansible_uri_payload.zip/ansible/module_utils/urls.py",
>>  
>> line 1251, in open_url
>>     use_gssapi=use_gssapi, unix_socket=unix_socket)
>>   File 
>> "/tmp/ansible_uri_payload__lMgyr/ansible_uri_payload.zip/ansible/module_utils/urls.py",
>>  
>> line 1157, in open
>>     r = urllib_request.urlopen(*urlopen_args)
>>   File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
>>     return opener.open(url, data, timeout)
>>   File "/usr/lib64/python2.7/urllib2.py", line 423, in open
>>     protocol = req.get_type()
>>   File "/usr/lib64/python2.7/urllib2.py", line 285, in get_type
>>     raise ValueError, "unknown url type: %s" % self.__original
>>
>>
>>
>> 1. Why is Ansible ignoring the follow_redirects setting
>> 2. Can Ansible follow relative URLs on 302?
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/10ec1717-6606-4dec-a19f-8cbdf5a68174%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/10ec1717-6606-4dec-a19f-8cbdf5a68174%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
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/c89177aa-ed7c-4c14-97fe-216827c391ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to