The other day some security changes were applied to our build system and repositories (auth, basically). Interestingly enough, if you tried to download a valid file, but your user didn't have permission to do so, the file would appear to download but would only contain some 404 related message inside.

We had upated our playbooks to include the required authentication, but because of the way the get_url module works, our CI was completely broken for a few hours. Since we haven't updated our Ansible Playbooks to work with version 2.0 yet, we weren't able to use the force_basic_auth parameter, which we really needed. (This is also where I say requiring a 401 before sending auth is stupid.)

Our first immediate band-aid was just to use the shell module like this:

- shell: curl -u user:password http://repo.domain/path/to/file.ext

That worked, but it's ugly.

Rather than spend a ton of time updating things to work with 2.0, I ended up just throwing this quick little module together:

It might not follow best practices, and it might not be super sexy, but it works pretty well and bought us some time while we work towards migrating away from Ansible and over to Salt Stack.