Skip to content

Commit

Permalink
Merge pull request #101 from ansiblebit/develop
Browse files Browse the repository at this point in the history
6.22.6
  • Loading branch information
steenzout authored Oct 24, 2018
2 parents 18ee08f + 374c5c2 commit 3e94500
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 51 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ DISCLAIMER: usage of any version of this role implies you have accepted the
## Role Variables

- **debug**: flag to make role more verbose.
- **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.
Expand Down Expand Up @@ -77,6 +76,7 @@ See `debian | ubuntu | Java 8` example in the _Playbooks_ section.
- **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_license_version**: which Oracle license version you will be accepting.
- **oracle_java_state**:** the package state (see Ansible apt module for more information).

### Redhat-only
Expand All @@ -102,7 +102,7 @@ See `redhat | centos 7 | Java 8` example in the _Playbooks_ section.
roles:
- role: ansiblebit.oracle-java

# debian | Java 10
# debian | Java 11
- hosts: servers
roles:
- role: ansiblebit.oracle-java
Expand All @@ -123,10 +123,11 @@ See `redhat | centos 7 | Java 8` example in the _Playbooks_ section.
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_license_version: "shared/accepted-oracle-license-v1-1"
oracle_java_set_as_default: no
oracle_java_state: latest

# debian | ubuntu | Java 10
# debian | ubuntu | Java 11
- hosts: servers
roles:
- role: ansiblebit.oracle-java
Expand All @@ -138,13 +139,14 @@ See `redhat | centos 7 | Java 8` example in the _Playbooks_ section.
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_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_license_version: "shared/accepted-oracle-license-v1-1"
oracle_java_set_as_default: no
oracle_java_state: latest

# redhat | centos 7 | Java 10
# redhat | centos 7 | Java 11
- hosts: servers
roles:
- role: ansiblebit.oracle-java
Expand All @@ -153,15 +155,16 @@ See `redhat | centos 7 | Java 8` example in the _Playbooks_ section.
- hosts: servers
roles:
- role: ansiblebit.oracle-java
oracle_java_use_defaults: no
oracle_java_dir_source: '/usr/local/src'
oracle_java_download_timeout: 60
oracle_java_rpm_filename: 'jdk-8u181-linux-x64.rpm'
oracle_java_rpm_filename: 'jdk-8u191-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_url: 'http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.rpm'
oracle_java_rpm_validate_certs: yes
oracle_java_set_as_default: no
oracle_java_version_string: 1.8.0_181
oracle_java_version_string: 1.8.0_191
```
Use `--skip-tags=debug` if you want to suppress debug information.
Expand Down
2 changes: 0 additions & 2 deletions defaults/darwin-macosx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

oracle_java_dir_source: "{{ ansible_env.HOME }}/Downloads"
oracle_java_dmg_filename: ""
oracle_java_os_supported: no

oracle_java_dmg_url: "/{{ oracle_java_dmg_filename }}"
10 changes: 5 additions & 5 deletions defaults/debian-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# Default variables for Ubuntu Linux distributions.
#

oracle_java_apt_repository: "ppa:linuxuprising/java"
oracle_java_apt_repository: 'ppa:linuxuprising/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_os_supported: yes
oracle_java_deb_package: 'oracle-java11-installer'
oracle_java_debconf_package_default: 'oracle-java11-set-default'
oracle_java_home: "/usr/lib/jvm/java-11-oracle"
oracle_java_license_version: 'shared/accepted-oracle-license-v1-2'
oracle_java_state: latest
8 changes: 4 additions & 4 deletions defaults/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
oracle_java_apt_repository: 'deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main'
oracle_java_apt_repository_key: 'EA8CACC073C3DB2A'
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_os_supported: yes
oracle_java_deb_package: 'oracle-java11-installer'
oracle_java_debconf_package_default: 'oracle-java11-set-default'
oracle_java_home: "/usr/lib/jvm/java-11-oracle"
oracle_java_license_version: 'shared/accepted-oracle-license-v1-2'
oracle_java_state: latest
1 change: 0 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
# defaults file
#

oracle_java_os_supported: yes
oracle_java_set_as_default: yes
oracle_java_use_defaults: yes
9 changes: 4 additions & 5 deletions defaults/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

oracle_java_dir_source: '/usr/local/src'
oracle_java_download_timeout: 60
oracle_java_rpm_filename: 'jdk-10.0.2_linux-x64_bin.rpm'
oracle_java_rpm_filename: 'jdk-11.0.1_linux-x64_bin.rpm'
oracle_java_home: '/usr/java/default'
oracle_java_os_supported: yes
oracle_java_rpm_url: 'http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.rpm'
oracle_java_rpm_url: 'http://download.oracle.com/otn-pub/java/jdk/11.0.1+13/90cf5d8f270a4347a95050320eef3fb7/jdk-11.0.1_linux-x64_bin.rpm'
oracle_java_rpm_validate_certs: yes
oracle_java_version: 10
oracle_java_version_string: 10.0.2
oracle_java_version: 11
oracle_java_version_string: 11.0.1
1 change: 1 addition & 0 deletions tasks/check_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@
- oracle_java_task_installed
- oracle_java_task_version
- oracle_java_version_installed
tags: [ debug ]
2 changes: 1 addition & 1 deletion tasks/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
- oracle_java_cache_valid_time
- oracle_java_home
- oracle_java_installed
- oracle_java_os_supported
- oracle_java_apt_repository
- oracle_java_apt_repository_key
- oracle_java_license_version
- oracle_java_set_as_default
- oracle_java_state
- oracle_java_version_installed
Expand Down
3 changes: 2 additions & 1 deletion tasks/installation/debian/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
- name: debian | set license as accepted
debconf:
name="{{ oracle_java_deb_package }}"
question='shared/accepted-oracle-license-v1-1'
question="{{ oracle_java_license_version }}"
value='true'
vtype='select'
become: yes
become: yes

- name: debian | ensure Java is installed
apt:
Expand Down
7 changes: 1 addition & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@

- include: debug.yml
when: debug | default(false)
tags: debug

- name: check if operating system is suported
fail:
msg: "The operating system ({{ ansible_os_family }}) of the target machine ({{ inventory_hostname }}) is not currently supported."
when: oracle_java_os_supported is not defined or not oracle_java_os_supported
tags: [ debug ]

## include OS family/distribution specific task file

Expand Down
15 changes: 2 additions & 13 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,11 @@
gather_facts: yes
vars:
debug: yes
test_redhat_java_version: '10.0.2'
test_debian_java_version: '10.0.2'
test_expected_java_version: '11.0.1'

roles:
- role: oracle-java
when: ansible_os_family | lower == 'redhat'

- role: tests
expected_java_version: "{{ test_redhat_java_version }}"
expected_java_version: "{{ test_expected_java_version }}"
tags: [ test ]
when: ansible_os_family | lower == 'redhat'

- role: oracle-java
when: ansible_os_family | lower == 'debian'

- role: tests
expected_java_version: "{{ test_debian_java_version }}"
tags: [ test ]
when: ansible_os_family | lower == 'debian'
5 changes: 2 additions & 3 deletions tests/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ ansible-playbook \
-e env=travis \
--skip-tags=test \
$@ \
&& bash test_checkmode.sh \
--env travis \
&& bash test_idempotence.sh \
--env travis \
&& bash test_checkmode.sh \
--env travis

0 comments on commit 3e94500

Please sign in to comment.