Skip to content

Commit

Permalink
Merge pull request #94 from ansiblebit/develop
Browse files Browse the repository at this point in the history
6.22.2
  • Loading branch information
steenzout authored Aug 20, 2018
2 parents 6f4d635 + ca4cd95 commit 2e871e0
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 42 deletions.
114 changes: 85 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,55 @@ DISCLAIMER: usage of any version of this role implies you have accepted the
## Role Variables

- **debug**: flag to make role more verbose.
- **oracle_java_set_as_default**: make the newly installed Java the default runtime environment (default: `yes`).
- **oracle_java_os_supported**: role internal variable to check if a OS family is supported or not.
- **oracle_java_set_as_default**: flag to indicate if this play should set Java as default (default: `yes`).
- **oracle_java_use_defaults**: flag to indicate you want to use defaults set in the `defaults` directory (default: `yes`).
**WARNING**. setting this to `no` will require the user to pass all of the distribution variables.
See `* | Java 8` examples in the _Playbooks_ section.

### Debian

- **oracle_java_apt_repository**: Personal Package Archive (PPA) from where to install Java (default: `deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main`).
- **oracle_java_apt_repository_key**: PPA repository key (default: `EA8CACC073C3DB2A`.
- **oracle_java_cache_valid_time**: the amount of time in seconds the apt cache is valid (default: `3600`).
- **oracle_java_deb_package**: name of debian package (default: `oracle-java10-installer`).
- **oracle_java_debconf_package_default**: (default: `oracle-java10-set-default`).
- **oracle_java_home**: the location of the Java home directory (default: `/usr/lib/jvm/java-10-oracle`).
- **oracle_java_state**:** the package state (see Ansible apt module for more information) (default: `latest`).
**WARNING** to override **any** of the following variables (even if it's only one),
you'll need to set `oracle_java_use_defaults: no` and override **all** of their values since
OS family defaults will no longer be loaded.
See `debian | Java 8` example in the _Playbooks_ section.

- **oracle_java_apt_repository**: Personal Package Archive (PPA) from where to install Java.
- **oracle_java_apt_repository_key**: PPA repository key.
- **oracle_java_cache_valid_time**: the amount of time in seconds the apt cache is valid.
- **oracle_java_deb_package**: name of debian package.
- **oracle_java_debconf_package_default**: name of debconf package to set default.
- **oracle_java_home**: the location of the Java home directory.
- **oracle_java_state**:** the package state (see Ansible apt module for more information).

### Debian/Ubuntu

- **oracle_java_apt_repository**: Personal Package Archive (PPA) from where to install Java (default: `ppa:linuxuprising/java`).
- **oracle_java_cache_valid_time**: the amount of time in seconds the apt cache is valid (default: `3600`).
- **oracle_java_deb_package**: name of debian package (default: `oracle-java10-installer`).
- **oracle_java_debconf_package_default**: (default: `oracle-java10-set-default`).
- **oracle_java_home**: the location of the Java home directory (default: `/usr/lib/jvm/java-10-oracle`).
- **oracle_java_state**:** the package state (see Ansible apt module for more information) (default: `latest`).
**WARNING** to override **any** of the following variables (even if it's only one),
you'll need to set `oracle_java_use_defaults: no` and override **all** of their values since
OS family defaults will no longer be loaded.
See `debian | ubuntu | Java 8` example in the _Playbooks_ section.

- **oracle_java_apt_repository**: Personal Package Archive (PPA) from where to install Java.
- **oracle_java_cache_valid_time**: the amount of time in seconds the apt cache is valid.
- **oracle_java_deb_package**: name of debian package.
- **oracle_java_debconf_package_default**: name of debconf package to set default.
- **oracle_java_home**: the location of the Java home directory.
- **oracle_java_state**:** the package state (see Ansible apt module for more information).

### Redhat-only

- **oracle_java_dir_source**: directory where to store the RPM files (default: `/usr/local/src`).
- **oracle_java_download_timeout**: download timeout, in seconds (default: `60`).
- **oracle_java_download_url**: where to download the rpm from (default: `http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.rpm`).
- **oracle_java_home**: the location of the Java home directory (default: `/usr/java/default`).
- **oracle_java_rpm_filename**: file name used for the download destination (default: `jdk-10.0.2_linux-x64_bin.rpm`).
- **oracle_java_rpm_validate_certs**: flag to indicate if you want SSL certificate validation (default: `yes`).
- **oracle_java_version**: the Oracle JDK version to be installed (default: `10`).
- **oracle_java_version_string**: the Java version string to verify installation against (default: `1.{{ oracle_java_version }}.0_u{{ oracle_java_version_update }}`).
**WARNING** to override **any** of the following variables (even if it's only one),
you'll need to set `oracle_java_use_defaults: no` and override **all** of their values since
OS family defaults will no longer be loaded.
See `redhat | centos 7 | Java 8` example in the _Playbooks_ section.

- **oracle_java_dir_source**: directory where to store the RPM files.
- **oracle_java_download_timeout**: download timeout, in seconds.
- **oracle_java_home**: the location of the Java home directory.
- **oracle_java_rpm_filename**: file name used for the download destination.
- **oracle_java_rpm_url**: where to download the rpm from.
- **oracle_java_rpm_validate_certs**: flag to indicate if you want SSL certificate validation.
- **oracle_java_version_string**: the Java version string to verify installation against.

## Playbooks

Expand All @@ -85,31 +102,70 @@ DISCLAIMER: usage of any version of this role implies you have accepted the
roles:
- role: ansiblebit.oracle-java

# debian + debian/ubuntu | Java 10
# debian | Java 10
- hosts: servers
roles:
- role: ansiblebit.oracle-java

# debian + debian/ubuntu | Java 8
## explicitely passing default parameters
- hosts: servers
roles:
- role: ansiblebit.oracle-java
oracle_java_apt_repository: "ppa:webupd8team/java"

# debian | custom | Java 10
# debian | Java 8
- hosts: servers
roles:
- role: ansiblebit.oracle-java
oracle_java_use_defaults: no
oracle_java_apt_repository: 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu bionic main'
oracle_java_apt_repository_key: 'EA8CACC073C3DB2A'
oracle_java_cache_valid_time: 3600
oracle_java_deb_package: 'oracle-java8-installer'
oracle_java_debconf_package_default: 'oracle-java8-set-default'
oracle_java_home: "/usr/lib/jvm/java-8-oracle"
oracle_java_set_as_default: no
oracle_java_state: latest

# debian | ubuntu | Java 10
- hosts: servers
roles:
- role: ansiblebit.oracle-java
oracle_java_apt_repository: 'deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main'

# debian | custom | Java 8
# debian | ubuntu | Java 8
- hosts: servers
roles:
- role: ansiblebit.oracle-java
oracle_java_apt_repository: 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu bionic main'
oracle_java_use_defaults: no
oracle_java_apt_repository: "ppa:webupd8team/java"
oracle_java_cache_valid_time: 3600
oracle_java_deb_package: 'oracle-java10-installer'
oracle_java_debconf_package_default: 'oracle-java10-set-default'
oracle_java_home: "/usr/lib/jvm/java-10-oracle"
oracle_java_set_as_default: no
oracle_java_state: latest

# redhat | centos 7 | Java 10
- hosts: servers
roles:
- role: ansiblebit.oracle-java

# redhat | centos 7 | Java 8
- hosts: servers
roles:
- role: ansiblebit.oracle-java
oracle_java_dir_source: '/usr/local/src'
oracle_java_download_timeout: 60
oracle_java_rpm_filename: 'jdk-8u181-linux-x64.rpm'
oracle_java_home: '/usr/java/default'
oracle_java_os_supported: yes
oracle_java_rpm_url: 'http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.rpm'
oracle_java_rpm_validate_certs: yes
oracle_java_set_as_default: no
oracle_java_version_string: 1.8.0_181
```
Use `--skip-tags=debug` if you want to suppress debug information.
```

## Test

Expand Down
6 changes: 2 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# defaults file
#

oracle_java_downloads:
10.0.2:
redhat: http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.rpm

oracle_java_os_supported: yes
oracle_java_set_as_default: yes
oracle_java_use_defaults: yes
1 change: 0 additions & 1 deletion tasks/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
- oracle_java_apt_repository_key
- oracle_java_set_as_default
- oracle_java_state
- oracle_java_version
- oracle_java_version_installed
- oracle_java_version_string
1 change: 1 addition & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- "installation/{{ ansible_os_family | lower }}/{{ ansible_distribution | lower }}_{{ ansible_distribution_version | lower }}.yml"
- "installation/{{ ansible_os_family | lower }}/{{ ansible_distribution | lower }}.yml"
- "installation/{{ ansible_os_family | lower }}/main.yml"
when: oracle_java_use_defaults
tags: [ installation ]

- name: check host environment
Expand Down
2 changes: 0 additions & 2 deletions tests/defaults/main.yml

This file was deleted.

6 changes: 0 additions & 6 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@

roles:
- role: oracle-java
oracle_java_version: "{{ test_redhat_java_version }}"
oracle_java_set_as_default: yes
oracle_java_rpm_validate_certs: no
when: ansible_os_family | lower == 'redhat'

- role: tests
Expand All @@ -41,9 +38,6 @@
when: ansible_os_family | lower == 'redhat'

- role: oracle-java
oracle_java_version: "{{ test_debian_java_version }}"
oracle_java_set_as_default: yes
oracle_java_rpm_validate_certs: no
when: ansible_os_family | lower == 'debian'

- role: tests
Expand Down

0 comments on commit 2e871e0

Please sign in to comment.