I recently came up against the same problem. There was a pull request to support play level environment keyword and it was merged not too long ago.
https://github.com/ansible/ansible/pull/8651 I'm setting an environment variable in a group_vars file that filters down to all tasks run against that group. environment: http_proxy: http://proxy.com:8080 https_proxy: http://proxy.com:8080 On Thursday, March 19, 2015 at 9:28:49 AM UTC, Timo Ahokas wrote: > > This is a real pain for us when setting up environments with multiple > components & the need to add the proxy settings for each role/task. E.g. > setting up something like Maven/Mesos/Chronos/Marathon + Docker requires > numerous patches (adding the environments for individual tasks) for each > role. > > Is there some technical constraint that makes this difficult to implement? > > On Thursday, 19 March 2015 11:08:02 UTC+2, Timo Ahokas wrote: >> >> Hi, >> >> We're working in an environment where all access outside needs to go >> through HTTP/HTTPS proxies. We have previously solved this by defining a >> global environment variable with the necessary proxy definitions >> (http_proxy, https_proxy, no_proxy) and then have passed that down to each >> task with "environment". But this means we need to patch most >> public/external playbooks for the tasks that require external access (e.g. >> package installs, resource download etc). >> >> Is there any way to make the proxy environment automatically available >> for all tasks without adding the "environment: proxy_env" for all >> individual tasks? >> >> Thanks, >> Timo >> > -- 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/b30ed891-d10a-4432-a80a-2df8d92e16fe%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
