Browse Source

java: support for Oracle JRE

tags/9.3.0^2
Victor Laborie 2 years ago
parent
commit
fbd97a5f08
16 changed files with 126 additions and 43 deletions
  1. +2
    -0
      CHANGELOG.md
  2. +1
    -1
      elasticsearch/meta/main.yml
  3. +0
    -0
      java/.kitchen.yml
  4. +14
    -0
      java/README.md
  5. +4
    -0
      java/defaults/main.yml
  6. +2
    -1
      java/meta/main.yml
  7. +10
    -0
      java/tasks/main.yml
  8. +31
    -0
      java/tasks/openjdk.yml
  9. +58
    -0
      java/tasks/oracle.yml
  10. +1
    -1
      java/tests/test.yml
  11. +1
    -0
      java8
  12. +0
    -11
      java8/README.md
  13. +0
    -1
      java8/defaults/main.yml
  14. +0
    -26
      java8/tasks/main.yml
  15. +1
    -1
      jenkins/meta/main.yml
  16. +1
    -1
      logstash/meta/main.yml

+ 2
- 0
CHANGELOG.md View File

@@ -15,6 +15,7 @@ The **patch** part changes incrementally at each release.
* elasticsearch: add http.publish_host variable
* kibana: log messages go to /var/log/kibana/kibana.log
* mysql: add an option to install the client development libraries (default: `False`)
* java: support for Oracle JRE

### Changed
* evolinux-users: add sudo permission for bkctld check
@@ -23,6 +24,7 @@ The **patch** part changes incrementally at each release.
* rbenv: change default Ruby version (2.5.1)
* rbenv: switch from copy to lineinfile for default gems
* squid: add a few news sites to the whitelist
* java8: renamed to java (java8 symlinked to java for backward compatibility)

### Fixed



+ 1
- 1
elasticsearch/meta/main.yml View File

@@ -25,4 +25,4 @@ galaxy_info:
# alphanumeric characters. Maximum 20 tags per role.

dependencies:
- java8
- { role: java, alternative: 'openjdk', java_version: 8 }

java8/.kitchen.yml → java/.kitchen.yml View File


+ 14
- 0
java/README.md View File

@@ -0,0 +1,14 @@
# java

Install OpenJDK or OracleJDK

## Tasks

* `openjdk.yml` : install of OpenJDK
* `oracle.yml` : install or OracleJDK

## Available variables

* `java_alternative`: choose between openjdk or oraclejdk (default to openjdk)
* `java_version`: java version (default to 8)
* `java_default_alternative`: make this verison the default alternative (default to true)

+ 4
- 0
java/defaults/main.yml View File

@@ -0,0 +1,4 @@
---
java_alternative: 'openjdk'
java_version: 8
java_default_alternative: True

java8/meta/main.yml → java/meta/main.yml View File

@@ -1,7 +1,7 @@
---
galaxy_info:
author: Evolix
description: Installation of Java 8
description: Installation of Java

issue_tracker_url: https://forge.evolix.org/projects/ansible-roles/issues

@@ -13,3 +13,4 @@ galaxy_info:
- name: Debian
versions:
- jessie
- stretch

+ 10
- 0
java/tasks/main.yml View File

@@ -0,0 +1,10 @@
---
- fail:
msg: "This role support only java 8 for now !"
when: java_version != 8

- include: openjdk.yml
when: "{{ java_alternative == 'openjdk' }}"

- include: oracle.yml
when: "{{ java_alternative == 'oracle' }}"

+ 31
- 0
java/tasks/openjdk.yml View File

@@ -0,0 +1,31 @@
---
- name: Decide which Debian release to use
set_fact:
java_apt_release: '{% if ansible_distribution_release == "jessie" %}jessie-backports{% else %}{{ ansible_distribution_release }}{% endif %}'
tags:
- java

- name: Install jessie-backports
include_role:
name: apt
tasks_from: backports.yml
when: ansible_distribution_release == "jessie"
tags:
- java

- name: Install openjdk package
apt:
name: "openjdk-{{ java_version}}-jre-headless"
default_release: "{{ java_apt_release }}"
state: present
tags:
- java
- packages

- name: This openjdk version is the default alternative
alternatives:
name: java
path: "/usr/lib/jvm/java-{{ java_version }}-openjdk-amd64/jre/bin/java"
when: java_default_alternative
tags:
- java

+ 58
- 0
java/tasks/oracle.yml View File

@@ -0,0 +1,58 @@
---
- name: Install dependencies for build java package
apt:
name: "{{ item }}"
state: present
with_items:
- java-package
- build-essential
tags:
- java

- name: Create jvm dir
file:
path: "{{ item }}"
state: directory
mode: "0777"
with_items:
- /srv/java-package
- /srv/java-package/src
- /srv/java-package/tmp
tags:
- java

- name: Get Oracle jre archive
get_url:
url: 'http://download.oracle.com/otn-pub/java/jdk/8u172-b11/a58eab1ec242421181065cdc37240b08/jre-8u172-linux-x64.tar.gz'
dest: '/srv/java-package/src/'
checksum: 'sha256:f08f25aec2bdc86138ccba8fd5b904451e3afa1d24a88c85f28c2d84bfd45bad'
headers: 'Cookie: oraclelicense=accept-securebackup-cookie'
mode: "0644"
tags:
- java

- name: Make Debian package from Oracle JDK archive
shell: "yes | TMPDIR=/srv/java-package/tmp make-jpkg /srv/java-package/src/jre-8u172-linux-x64.tar.gz"
args:
chdir: /srv/java-package
creates: /srv/java-package/oracle-java8-jre_8u172_amd64.deb
become: False
tags:
- java

- include_role:
name: remount-usr

- name: Install java package
apt:
deb: /srv/java-package/oracle-java8-jre_8u172_amd64.deb
tags:
- java

- name: This openjdk version is the default alternative
alternatives:
name: java
path: "/usr/lib/jvm/jre-{{ java_version }}-oracle-x64/bin/java"
when: java_default_alternative
tags:
- java

java8/tests/test.yml → java/tests/test.yml View File

@@ -1,4 +1,4 @@
---
- hosts: test-kitchen
roles:
- role: java8
- role: java

+ 1
- 0
java8 View File

@@ -0,0 +1 @@
java

+ 0
- 11
java8/README.md View File

@@ -1,11 +0,0 @@
# java8

Install OpenJDK 1.8 (from jessie-backports)

## Tasks

Everything is in the `tasks/main.yml` file.

## Available variables

* `java8_default_alternative`: make this verison the default alternative (defaults to true)

+ 0
- 1
java8/defaults/main.yml View File

@@ -1,2 +0,0 @@
java8_default_alternative: True

+ 0
- 26
java8/tasks/main.yml View File

@@ -1,27 +0,0 @@
- name: Decide which Debian release to use
set_fact:
java8_apt_release: '{% if ansible_distribution_release == "jessie" %}jessie-backports{% else %}{{ ansible_distribution_release }}{% endif %}'

- name: install jessie-backports
include_role:
name: apt
tasks_from: backports.yml
when: ansible_distribution_release == "jessie"

- name: Java 8 is installed
apt:
name: openjdk-8-jre-headless
default_release: "{{ java8_apt_release }}"
state: present
tags:
- java
- packages

- name: Java 8 is the default alternative
alternatives:
name: java
path: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
when: java8_default_alternative
tags:
- java

+ 1
- 1
jenkins/meta/main.yml View File

@@ -24,4 +24,4 @@ galaxy_info:
# alphanumeric characters. Maximum 20 tags per role.

dependencies:
- java8
- { role: java, java_alternative: 'openjdk', java_version: 8 }

+ 1
- 1
logstash/meta/main.yml View File

@@ -14,4 +14,4 @@ galaxy_info:
- jessie

dependencies:
- java8
- { role: java, java_alternative: 'openjdk', java_version: 8 }

Loading…
Cancel
Save