1

I'm using an Ansible role from Ansible Galaxy which downloads some software from the Internet and then installs it. It uses the get_url module to do that. The problem is that I am working behind a corporate proxy that will first download the software and then send it to the Ansible playbook running. It causes get_url to hit its default timeout of 10s. It is working fine if I increase the timeout. As I'm using a third party role, I don't want to modify it and was wondering if there was any way to increase the get_url timeout at the playbook level instead.

Renaud Martinet
  • 198
  • 1
  • 7

2 Answers2

1

You can set proxy globally via environment, but not timeout.

As a workaround, you can make custom action plugin to decorate get_url calls.
It can overwrite timeout parameter with increased value instead of default 10.

I've posted example of this technique for setup module here.

Community
  • 1
  • 1
Konstantin Suvorov
  • 65,183
  • 9
  • 162
  • 193
  • For now I went with a wrapper role that plays the get_url task before the third-party role gets called. But your solution looks way cleaner as it can be used for all instances of get_url and be kept out of source control so it is only used as fix on my environment. I'll give it a try and accept your answer if it works. Thanks anyway! – Renaud Martinet Feb 02 '17 at 21:10
  • WIll it set proxy for all modules like `win_chocolatey`? – mvorisek Jun 16 '19 at 10:48
0

~/.ansible.cfg

[persistent_connection]
command_timeout = 60
sjas
  • 18,644
  • 14
  • 87
  • 92