library/roles/openjdk: Some fixes. Install the 'headless' version of jre/jdk.
This commit is contained in:
parent
5b15e502db
commit
e4097fa045
|
@ -1,8 +1,13 @@
|
||||||
---
|
---
|
||||||
openjdk_default: 7
|
openjdk_default: 8
|
||||||
openjdk_pkg_state: installed
|
openjdk_pkg_state: latest
|
||||||
openjdk_version:
|
openjdk_version:
|
||||||
- '{{ openjdk_default }}'
|
- '{{ openjdk_default }}'
|
||||||
|
|
||||||
|
openjdk_ppa: 'ppa:openjdk-r/ppa'
|
||||||
|
|
||||||
jdk_java_home: '/usr/lib/jvm/java-{{ openjdk_default }}-openjdk-amd64'
|
jdk_java_home: '/usr/lib/jvm/java-{{ openjdk_default }}-openjdk-amd64'
|
||||||
|
|
||||||
|
openjdk_pkgs:
|
||||||
|
- jre-headless
|
||||||
|
- jdk-headless
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
shell: update-java-alternatives -s java-1.8.0-openjdk-amd64
|
shell: update-java-alternatives -s java-1.8.0-openjdk-amd64
|
||||||
|
|
||||||
- name: Set the default OpenJDK
|
- name: Set the default OpenJDK
|
||||||
shell: update-java-alternatives -s java-'{{ item }}'-openjdk-amd64
|
shell: update-java-alternatives -s java-1.{{ item }}.0-openjdk-amd64
|
||||||
with_items: openjdk_default
|
with_items: '{{ openjdk_default }}'
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
---
|
---
|
||||||
- name: Update the apt cache, if needed
|
- block:
|
||||||
apt: update_cache=yes
|
- name: Add the openjdk ppa. To have openjdk 8/9 on precise and trusty
|
||||||
when: openjdk_pkg_state == 'latest'
|
apt_repository: repo='{{ openjdk_ppa }}' update_cache=yes
|
||||||
tags: jdk
|
|
||||||
|
- name: Update the apt cache, if needed
|
||||||
|
apt: update_cache=yes cache_valid_time=1800
|
||||||
|
when: openjdk_pkg_state == 'latest'
|
||||||
|
|
||||||
- name: install OpenJDK JRE
|
- name: install OpenJDK JRE
|
||||||
apt: pkg=openjdk-{{ item.0 }}-{{ item[1] }} state={{ openjdk_pkg_state }}
|
apt: pkg=openjdk-{{ item.0 }}-{{ item[1] }} state={{ openjdk_pkg_state }}
|
||||||
with_nested:
|
with_nested:
|
||||||
- '{{ openjdk_version }}'
|
- '{{ openjdk_version }}'
|
||||||
- [ 'jre', 'jre-headless', 'jdk' ]
|
- '{{ openjdk_pkgs }}'
|
||||||
notify: Set the default OpenJDK
|
# - [ 'jre', 'jre-headless', 'jdk' ]
|
||||||
tags: jdk
|
notify: Set the default OpenJDK
|
||||||
|
|
||||||
- name: Set fact jdk_installed
|
- name: Set fact jdk_installed
|
||||||
set_fact: jdk_installed=true
|
set_fact: jdk_installed=true
|
||||||
tags: jdk
|
|
||||||
|
|
||||||
|
tags: [ 'jdk', 'openjdk' ]
|
||||||
|
|
Loading…
Reference in New Issue