Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proxy support #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ java_set_javahome: false

# install JCE?
java_install_jce: false

# use internal proxy url for instances behind a firewall
java_use_proxy: true

# url to use when proxy is true, usually a nexus proxy
java_proxy_url:
```

For other configurable internals, read `tasks/set-role-variables.yml` file; for example, supported `java_version`/`java_subversion` combinations.
Expand All @@ -72,7 +78,7 @@ If you want to install a Java release which is not supported out-of-the-box, you

### Customized variables, if absolutely necessary

If you have a pre-downloaded `jdk_tarball_file` whose filename cannot be inferred successfully by `tasks/set-role-variables.yml`, you may specify it explicitly:
If you have a pre-downloaded `jdk_tarball_file` whose filename cannot be inferred successfully by `tasks/set-role-variables.yml`, you may specify it explicitly:

```yaml
# Specify the pre-fetch filename (without tailing .tar.gz or .rpm or .dmg);
Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ java_remove_download: true
java_install_jce: false

java_set_javahome: false
java_use_proxy: false
java_remote_url: "http://download.oracle.com/otn-pub"
java_proxy_url:
13 changes: 10 additions & 3 deletions tasks/set-role-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
set_fact:
jdk_version: "1.{{ java_version }}.0_{{ java_subversion }}"

- name: set remote java url
set_fact:
java_url: "{{java_remote_url}}"
when: "{{java_use_proxy}} == false"

- name: set proxy java url
set_fact:
java_url: "{{java_proxy_url}}"
when: "{{java_use_proxy}} == true"
#
# platform-specific variables
#
Expand Down Expand Up @@ -129,7 +137,7 @@

- name: compose url for downloading file, if necessary
set_fact:
jdk_tarball_url: "http://download.oracle.com/otn-pub/java/jdk/{{ jdk_version_detail }}/{{ jdk_tarball_file }}"
jdk_tarball_url: "{{ java_url }}/java/jdk/{{ jdk_version_detail }}/{{ jdk_tarball_file }}"
when: jdk_version_detail is defined


Expand All @@ -151,8 +159,7 @@

- name: set JCE download file
set_fact:
jce_zip_url: "http://download.oracle.com/otn-pub/java/jce/{{ java_version }}/{{ jce_zip_file }}"

jce_zip_url: "{{java_url}}/java/jce/{{ java_version }}/{{ jce_zip_file }}"

#
# directories
Expand Down