get_url and preemptive authentication?

195 views
Skip to first unread message

Mirko Friedenhagen

unread,
Nov 24, 2014, 8:10:40 AM11/24/14
to ansible...@googlegroups.com
Hello,

we provide user specific settings for our Maven repository via a HTTP
GET request[1], but have the usecase that "anonymous" has read-only
access, so authentication is not strictly enforced.

I try to setup our CI system with ansible coming from a shell based
setup, where I have:

curl --netrc -o ~/.m2/settings.xml http://repo/path/settings.xml

Now, curl sends the basic auth header in any case, while get_url[2]
waits for a 401 to come back before offering credentials. So with
get_url the credentials are not used but the settings.xml for
anonymous are downloaded.

I could implement a PR with an option to send authentication
preemptively and default to the current behavior.

On the other hand I think anyone using get_url with url_password knows
that authentication is needed, so IMO sending the auth-header directly
by default would be more useful and the current behavior only produces
the overhead of additional requests.



Regards Mirko
[1] we use Artifactory templating here.
[2] inspecting ansible/module_utils/urls.py
--
http://illegalstateexception.blogspot.com/
https://github.com/mfriedenhagen/ (http://osrc.dfm.io/mfriedenhagen)
https://bitbucket.org/mfriedenhagen/

Matt Martz

unread,
Nov 24, 2014, 8:30:43 AM11/24/14
to ansible...@googlegroups.com
You might be interested in https://github.com/ansible/ansible-modules-core/pull/153
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAK8jvqxMrnvCVyY_piSxLZUM1%2BGEC3%3D%2BFERERSgBXZ5DVDhmPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

Mirko Friedenhagen

unread,
Nov 24, 2014, 4:22:10 PM11/24/14
to ansible-project

Michael DeHaan

unread,
Nov 24, 2014, 5:28:43 PM11/24/14
to ansible...@googlegroups.com
1.8 is releasing soon so this is unlikely.  

It is prioritized p3 so it's next in line though.

You can use your own version of get_url by dropping in "./library" relative to your playbook, which would allow you to use this today.



Mirko Friedenhagen

unread,
Nov 25, 2014, 3:33:43 AM11/25/14
to ansible-project

Thanks, good to know :-)

Regards
Mirko
--
Sent from my mobile

Reply all
Reply to author
Forward
0 new messages