main.yml 1.5 KB
Newer Older
John Jarvis committed
1 2 3
---

# oraclejdk
4
#
John Jarvis committed
5 6 7
# Dependencies:
#
#   * common
8
#
John Jarvis committed
9 10 11 12 13 14
# Example play:
#
#   roles:
#   - common
#   - oraclejdk

15
- name: download Oracle Java
John Jarvis committed
16
  shell: >
17
    curl -b gpw_e24=http%3A%2F%2Fwww.oracle.com -b oraclelicense=accept-securebackup-cookie -O -L {{ oraclejdk_url }}
18 19 20
    executable=/bin/bash
    chdir=/var/tmp
    creates=/var/tmp/{{ oraclejdk_file }}
21

22 23 24 25 26 27 28 29
- name: create jvm dir
  file: >
    path=/usr/lib/jvm
    state=directory
    owner=root
    group=root

- name: untar Oracle Java
John Jarvis committed
30
  shell: >
31
    tar -C /usr/lib/jvm -zxvf /var/tmp/{{ oraclejdk_file }}
32
    executable=/bin/bash
33
    creates=/usr/lib/jvm/{{ oraclejdk_base }}
34

35
- name: create symlink expected by elasticsearch
36
  file: src=/usr/lib/jvm/{{ oraclejdk_base }} dest={{ oraclejdk_link }} state=link
37

e0d committed
38 39 40
- name: update alternatives java
  shell: >
    update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/{{ oraclejdk_base }}/bin/java" 1
41 42
  register: update_alt
  changed_when: update_alt.stdout != ""
e0d committed
43 44 45 46

- name: update alternatives javac
  shell: >
    update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/{{ oraclejdk_base }}/bin/javac" 1
47 48
  register: update_alt
  changed_when: update_alt.stdout != ""
e0d committed
49 50 51 52

- name: update alternatives javaws
  shell: >
    update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/{{ oraclejdk_base }}/bin/javaws" 1
53 54 55
  register: update_alt
  changed_when: update_alt.stdout != ""

56
- name: add JAVA_HOME for Oracle Java
57
  template: src=java.sh.j2 dest=/etc/profile.d/java.sh owner=root group=root mode=0755