Does apt_key use proxy environment vars?

826 views
Skip to first unread message

Jon Soul

unread,
Mar 18, 2015, 11:29:05 AM3/18/15
to ansible...@googlegroups.com
I'm using a role in my playbook that uses the apt_key module:

- name: import repository key

The target host sits behind a proxy, and I have the usual proxy environment variables already set.  This is enough to get various apt, apt_repository and other external-resource-calling tasks to work without a problem. However apt_key fails:

msg: Failed to download key at http://www.rabbitmq.com/rabbitmq-signing-key-public.asc: Request failed: <urlopen error timed out>

If I explicitly set the environment proxy variables on the task then the problem is resolved (as below).  Why do I explicitly have to set the environment for apt_key and not other modules?  Is this intended?

- name: import repository key
  apt_key
: url=http://www.rabbitmq.com/rabbitmq-signing-key-public.asc state=present
  environment
:
    http_proxy
: http://proxy.domain.com:8080

Jon Soul

unread,
Mar 18, 2015, 11:40:23 AM3/18/15
to ansible...@googlegroups.com
I'm using Ubuntu 14.04 with ansible 1.8.4

Brian Coca

unread,
Mar 18, 2015, 11:51:08 AM3/18/15
to ansible...@googlegroups.com
I looked at the code and it is the following:

os.environ.get('https_proxy')


--
Brian Coca

Brian Coca

unread,
Mar 18, 2015, 11:54:46 AM3/18/15
to ansible...@googlegroups.com
never mind, checked all the codepaths and the module itself does not
support proxies
--
Brian Coca
Message has been deleted

Jon Soul

unread,
Mar 18, 2015, 12:07:38 PM3/18/15
to ansible...@googlegroups.com
Thanks for checking that out for me.

Jon Soul

unread,
Mar 18, 2015, 12:58:44 PM3/18/15
to ansible...@googlegroups.com
My workaround was to update to 1.9 so I could use the environment keyword at the play level.
Reply all
Reply to author
Forward
0 new messages