geerlingguy / ansible-role-java

Ansible Role - Java

Home Page:https://galaxy.ansible.com/geerlingguy/java/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Debian 8 Jessie - Java Version 8

DylanUnderwood opened this issue · comments

Can you include Java 8 from backport so we can use Solr 6?

@DylanUnderwood - For this particular role, I'm sticking with the system default packages—but it should be easy enough to shim in Java 8 whatever OS you're on. See my example from my Solr role (file: https://github.com/geerlingguy/ansible-role-solr/blob/master/tests/test-solr-6.yml#L11-L29), working example (at least I should think it would work!):

- hosts: solr
  become: yes

  vars:
      java_packages:
          - openjdk-8-jdk

  pre_tasks:
    - name: Enable Backports repository.
      apt_repository:
        repo: 'deb http://ftp.debian.org/debian {{ ansible_distribution_release }}-backports main'
        state: present
        filename: "{{ ansible_distribution_release }}_backports"

    - name: Update apt cache.
      apt: update_cache=yes cache_valid_time=600

  roles:
    - geerlingguy.java
    - geerlingguy.solr

Its not detecting the Debian OS and using the backport its still using version 7

@DylanUnderwood - This role will install whatever the default is for an OS. So on Debian 8 it installs Java 7 by default.

If you want it to install Java 8, then you'd need to add something like what's above to your own playbook (especially the java_packages variable definition).

Are you saying that if you run a playbook with code like above, it isn't working? Note that this wouldn't upgrade the current version of Java on a server; to do that you'd need to also uninstall Java 7 first. But I would usually just delete the server and provision fresh, that way there's no old java junk left.

I was doing a new server and it installed 7 when i said 8 based on the code provided.

DrupalVM with Solr 6.4 needs Java 8.
I made a box image with Java 8 but the playbook was overriding the already installed java because Solr was checked to be installed.

@DylanUnderwood - Are you trying to install Java by hand? If so, the Ansible playbooks that are used with Drupal VM / elsewhere don't know about manual changes, and will keep resetting things back to defaults.

If you need to use a different version of Java with Drupal VM, then you need to set the java_packages in your Drupal VM config.yml file, and also add a task that you run in a pre-provision script or task file (if using Debian 8 as your base box)—see http://docs.drupalvm.com/en/latest/extending/scripts/#ansible-task-files