diff --git a/tasks/http_client_proxy.yml b/tasks/http_client_proxy.yml index 078df82..f4338a6 100644 --- a/tasks/http_client_proxy.yml +++ b/tasks/http_client_proxy.yml @@ -1,12 +1,18 @@ --- - name: Proxy in the global shell environment block: - - name: Install the proxy environment file - template: src=10-caching-proxy.sh.j2 dest=/etc/profile.d/10-caching-proxy.sh owner=root group=root mode=0444 - when: enable_env_proxy | bool + - name: Install the proxy environment files + template: src={{ item }}.j2 dest=/etc/profile.d/{{ item }} owner=root group=root mode=0444 + with_items: + - 10-caching-proxy.sh + - 10-java-caching-proxy.sh + when: enable_env_proxy - name: Remove the proxy environment file if not required - file: dest=/etc/profile.d/10-caching-proxy.sh state=absent - when: not enable_env_proxy | bool + file: dest=/etc/profile.d/{{ item }} state=absent + with_items: + - 10-caching-proxy.sh + - 10-java-caching-proxy.sh + when: not enable_env_proxy tags: [ 'systemsetup', 'proxyenv' ] diff --git a/templates/10-java-caching-proxy.sh.j2 b/templates/10-java-caching-proxy.sh.j2 new file mode 100644 index 0000000..30c74bc --- /dev/null +++ b/templates/10-java-caching-proxy.sh.j2 @@ -0,0 +1 @@ +export JAVA_OPTS='-DproxySet=true -Dhttp.proxyHost={{ env_proxy_http_host }} -Dhttp.proxyPort={{ env_proxy_http_port }} -Dhttps.proxyHost={{ env_proxy_http_host }} -Dhttps.proxyPort={{ env_proxy_http_port }} -Dhttp.nonProxyHosts="{% for noproxy_h in no_proxy_target %}{{ noproxy_h }}{% if not loop.last %}|{% endif %}{% endfor %}" $JAVA_OPTS'