Coder Social home page Coder Social logo

ansiblebit / oracle-java Goto Github PK

View Code? Open in Web Editor NEW
141.0 12.0 86.0 333 KB

Ansible role to install Oracle Java 8/11 on Debian and RedHat based distributions.

Home Page: https://galaxy.ansible.com/ansiblebit/oracle-java/

License: BSD 3-Clause "New" or "Revised" License

Ruby 20.67% Python 11.22% Shell 68.11%
ansible java debian ubuntu redhat centos centos7 ubuntu-precise ubuntu-trusty ubuntu-xenial debian-jessie ubuntu-cosmic oracle

oracle-java's Introduction

ansiblebit.oracle-java

License Build Status

Platform Platform Platform Platform

Project Stats

An Ansible role to setup Oracle Java Development Kit.

DISCLAIMER: usage of any version of this role implies you have accepted the Oracle Binary Code License Agreement for Java SE.

Tests

Family Distribution Version Test Status
Debian Debian Jessie x86_64
Debian Debian Stretch x86_64
Debian Ubuntu Precise x86_64
Debian Ubuntu Yakkety x86_64
Debian Ubuntu Xenial x86_64
Debian Ubuntu Trusty x86_64
Debian Ubuntu Vivid x86_64
Debian Ubuntu Wily x86_64
Debian Ubuntu Artful x86_64
Debian Ubuntu Bionic x86_64
Debian Ubuntu Cosmic x86_64
RedHat Centos 7 x86_64

Requirements

  • ansible >= 2.x

Facts

  • oracle_java_installed: fact set by this role that contains a flag that indicates if Java is installed on the host.
  • oracle_java_version_installed: fact set by this role that contains the string of the Java version installed in the system.

Role Variables

  • debug: flag to make role more verbose.
  • 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. See * | Java 11 examples in the Playbooks section.

Debian

WARNING to override any of the following variables (even if it's only one), you'll need to set oracle_java_use_defaults: no and override all of their values since OS family defaults will no longer be loaded. See debian | Java 11 example in the Playbooks section.

  • oracle_java_apt_repository: Personal Package Archive (PPA) from where to install Java.
  • oracle_java_apt_repository_key: PPA repository key.
  • oracle_java_cache_valid_time: the amount of time in seconds the apt cache is valid.
  • 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_state:** the package state (see Ansible apt module for more information).

Debian/Ubuntu

WARNING to override any of the following variables (even if it's only one), you'll need to set oracle_java_use_defaults: no and override all of their values since OS family defaults will no longer be loaded. See debian | ubuntu | Java 11 example in the Playbooks section.

  • oracle_java_apt_repository: Personal Package Archive (PPA) from where to install Java.
  • oracle_java_cache_valid_time: the amount of time in seconds the apt cache is valid.
  • 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

WARNING to override any of the following variables (even if it's only one), you'll need to set oracle_java_use_defaults: no and override all of their values since OS family defaults will no longer be loaded. See redhat | centos 7 | Java 11 example in the Playbooks section.

  • oracle_java_dir_source: directory where to store the RPM files.
  • oracle_java_download_timeout: download timeout, in seconds.
  • oracle_java_home: the location of the Java home directory.
  • oracle_java_rpm_filename: file name used for the download destination.
  • oracle_java_rpm_url: where to download the rpm from.
  • oracle_java_rpm_validate_certs: flag to indicate if you want SSL certificate validation.
  • oracle_java_version_string: the Java version string to verify installation against.

Playbooks

# generic
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java

# debian | Java 12
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java

# debian | Java 11
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java
      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"

## explicitely passing default parameters
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java

# debian | ubuntu | Java 12
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java

# debian | ubuntu | Java 11
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java
      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"

# redhat | centos 7 | Java 12
- hosts: servers
  roles:
    - role: ansiblebit.oracle-java

# redhat | centos 7 | Java 11
- 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-11.0.3_linux-x64_bin.rpm'
      oracle_java_home: '/usr/java/default'
      oracle_java_os_supported: yes
      oracle_java_rpm_url: 'https://download.oracle.com/otn/java/jdk/11.0.3+12/37f5e150db5247ab9333b11c1dddcd30/jdk-11.0.3_linux-x64_bin.rpm'
      oracle_java_rpm_validate_certs: yes
      oracle_java_set_as_default: no
      oracle_java_version_string: 11.0.3

Use --skip-tags=debug if you want to suppress debug information.

## Test

```bash
tox -e py27-ansible26 -- --box centos7-64.vagrant.dev

tox -e py27-ansible26 -- --box bionic64.vagrant.dev

# manual
source .tox/py27-ansible26/bin/activate
cd tests
vagrant up bionic64.vagrant.dev

bash test_idempotence.sh \
  --box bionic64.vagrant.dev \
  --inventory .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory

## look at idempotence test logs
less log/bionic64.vagrant.dev_idempotence_py27-ansible26.log

## debug
vagrant ssh bionic64.vagrant.dev

bash test_checkmode.sh \
  --box bionic64.vagrant.dev \
  --inventory .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory

## look at checkmode test logs
less log/bionic64.vagrant.dev_checkmode_py27-ansible26.log

vagrant destroy bionic64.vagrant.dev

Links

oracle-java's People

Contributors

030 avatar acrewdson avatar aittam avatar alexandrnikitin avatar ardentperf avatar bpineau avatar cwardgar avatar cyfdecyf avatar d4rkd0s avatar danmark avatar gaell avatar hryamzik avatar patsevanton avatar peshay avatar reactormonk avatar steenzout avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oracle-java's Issues

Java 6/7 Do not work on ubuntu

Mocked playbook

 - name: install java v7
   vars:
     oracle_java_set_as_default: false
     oracle_java_state: present
     oracle_java_version: 7
     oracle_java_home: /usr/lib/jvm/java-7-oracle
   roles:
    - ansiblebit.oracle-java

Result:

TASK [ansiblebit.oracle-java : debian | ensure Java is installed] *******************************************
task path: /Users/drada/workspace/code/cft-server-configs/ansible/galaxy_roles/ansiblebit.oracle-java/tasks/debian/main.yml:38
Using module file /usr/local/Cellar/ansible/2.3.0.0_2/libexec/lib/python2.7/site-packages/ansible/modules/packaging/os/apt.py
<192.168.244.2> ESTABLISH CONNECTION FOR USER: ubuntu on PORT 22 TO 192.168.244.2
<192.168.244.2> EXEC /bin/bash -c 'echo ~ && sleep 0'
<192.168.244.2> EXEC /bin/bash -c '( umask 77 && mkdir -p "` echo /home/ubuntu/.ansible/tmp/ansible-tmp-1497470518.57-136542900406420 `" && echo ansible-tmp-1497470518.57-136542900406420="` echo /home/ubuntu/.ansible/tmp/ansible-tmp-1497470518.57-136542900406420 `" ) && sleep 0'
<192.168.244.2> PUT /var/folders/0x/jl0rs2jx7bv1xwdfj1kk1ylm0000gn/T/tmpt2XNl4 TO /home/ubuntu/.ansible/tmp/ansible-tmp-1497470518.57-136542900406420/apt.py
<192.168.244.2> EXEC /bin/bash -c 'chmod u+x /home/ubuntu/.ansible/tmp/ansible-tmp-1497470518.57-136542900406420/ /home/ubuntu/.ansible/tmp/ansible-tmp-1497470518.57-136542900406420/apt.py && sleep 0'
<192.168.244.2> EXEC /bin/bash -c 'sudo -H -S -n -u root /bin/bash -c '"'"'echo BECOME-SUCCESS-hkovevwzffnuamqtyvnfilzkvuzrdvmq; /usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1497470518.57-136542900406420/apt.py; rm -rf "/home/ubuntu/.ansible/tmp/ansible-tmp-1497470518.57-136542900406420/" > /dev/null 2>&1'"'"' && sleep 0'
fatal: [weblocal01]: FAILED! => {
    "cache_update_time": 1497469415,
    "cache_updated": false,
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "allow_unauthenticated": false,
            "autoremove": null,
            "cache_valid_time": 3600,
            "deb": null,
            "default_release": null,
            "dpkg_options": "force-confdef,force-confold",
            "force": false,
            "install_recommends": null,
            "name": "oracle-java7-installer",
            "only_upgrade": false,
            "package": [
                "oracle-java7-installer"
            ],
            "purge": false,
            "state": "present",
            "update_cache": true,
            "upgrade": null
        }
    },
    "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'oracle-java7-installer'' failed: E: Sub-process /usr/bin/dpkg returned an error code (1)\n",
    "stderr": "E: Sub-process /usr/bin/dpkg returned an error code (1)\n",
    "stderr_lines": [
        "E: Sub-process /usr/bin/dpkg returned an error code (1)"
    ],
    "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\noracle-java7-installer is already the newest version (7u80+7u60arm-0~webupd8~1).\n0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.\n1 not fully installed or removed.\nAfter this operation, 0 B of additional disk space will be used.\nSetting up oracle-java7-installer (7u80+7u60arm-0~webupd8~1) ...\r\nDownloading Oracle Java 7...\r\n--2017-06-14 20:02:00--  http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz\r\nResolving download.oracle.com (download.oracle.com)... 23.62.7.139, 23.62.7.160\r\nConnecting to download.oracle.com (download.oracle.com)|23.62.7.139|:80... connected.\r\nHTTP request sent, awaiting response... 302 Moved Temporarily\r\nLocation: https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz [following]\r\n--2017-06-14 20:02:04--  https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz\r\nResolving edelivery.oracle.com (edelivery.oracle.com)... 23.49.182.138, 2001:418:1456:128d::2d3e, 2001:418:1456:12a7::2d3e\r\nConnecting to edelivery.oracle.com (edelivery.oracle.com)|23.49.182.138|:443... connected.\r\nHTTP request sent, awaiting response... 302 Moved Temporarily\r\nLocation: http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1497470649_4dfbcdfa6453dffd7d582e09dd6428ba [following]\r\n--2017-06-14 20:02:09--  http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1497470649_4dfbcdfa6453dffd7d582e09dd6428ba\r\nConnecting to download.oracle.com (download.oracle.com)|23.62.7.139|:80... connected.\r\nHTTP request sent, awaiting response... 404 Not Found\r\n2017-06-14 20:02:10 ERROR 404: Not Found.\r\n\r\ndownload failed\r\nOracle JDK 7 is NOT installed.\r\ndpkg: error processing package oracle-java7-installer (--configure):\r\n subprocess installed post-installation script returned error exit status 1\r\nErrors were encountered while processing:\r\n oracle-java7-installer\r\n",
    "stdout_lines": [
        "Reading package lists...",
        "Building dependency tree...",
        "Reading state information...",
        "oracle-java7-installer is already the newest version (7u80+7u60arm-0~webupd8~1).",
        "0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.",
        "1 not fully installed or removed.",
        "After this operation, 0 B of additional disk space will be used.",
        "Setting up oracle-java7-installer (7u80+7u60arm-0~webupd8~1) ...",
        "Downloading Oracle Java 7...",
        "--2017-06-14 20:02:00--  http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz",
        "Resolving download.oracle.com (download.oracle.com)... 23.62.7.139, 23.62.7.160",
        "Connecting to download.oracle.com (download.oracle.com)|23.62.7.139|:80... connected.",
        "HTTP request sent, awaiting response... 302 Moved Temporarily",
        "Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz [following]",
        "--2017-06-14 20:02:04--  https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz",
        "Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.49.182.138, 2001:418:1456:128d::2d3e, 2001:418:1456:12a7::2d3e",
        "Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.49.182.138|:443... connected.",
        "HTTP request sent, awaiting response... 302 Moved Temporarily",
        "Location: http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1497470649_4dfbcdfa6453dffd7d582e09dd6428ba [following]",
        "--2017-06-14 20:02:09--  http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1497470649_4dfbcdfa6453dffd7d582e09dd6428ba",
        "Connecting to download.oracle.com (download.oracle.com)|23.62.7.139|:80... connected.",
        "HTTP request sent, awaiting response... 404 Not Found",
        "2017-06-14 20:02:10 ERROR 404: Not Found.",
        "",
        "download failed",
        "Oracle JDK 7 is NOT installed.",
        "dpkg: error processing package oracle-java7-installer (--configure):",
        " subprocess installed post-installation script returned error exit status 1",
        "Errors were encountered while processing:",
        " oracle-java7-installer"
    ]
}

This is related to: http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html

My current work around was to create java-v7 role wrapper:

 - name: create this directory /var/cache/oracle-jdk7-installer
   file:
     name: /var/cache/oracle-jdk7-installer
     state: directory

 - name: download the java file from local host
   get_url:
     checksum: "sha256:bad9a731639655118740bee119139c1ed019737ec802a630dd7ad7aab4309623"
     dest: /var/cache/oracle-jdk7-installer/jdk-7u80-linux-x64.tar.gz
     url: "https://xxxxxx/jdk-7u80-linux-x64.tar.gz"

 - name: copy the files to the installer directory
   copy:
     dest: /var/cache/oracle-jdk7-installer/{{ item }}
     src: "{{ item }}"
   with_items:
     - fontconfig.Ubuntu.properties
     - jar.binfmt
     - javaws-wrapper.sh
     - wgetrc

 - name: add external java v7 role
   include_role:
     name: ansiblebit.oracle-java
   vars:
     oracle_java_set_as_default: "{{ java_v7_default }}"
     oracle_java_state: "{{ java_v7_state }}"
     oracle_java_version: 7
     oracle_java_home: /usr/lib/jvm/java-7-oracle

I am posting this here since I didn't see anyone else mentioning this error and I am not sure how to fix this (without the workaround) or allow your role to do this in some way.

I tried on both Ubuntu 16 and Ubuntu 14

Check Doesn't Work

Version: 1.9.4

Unable to run in check mode. Maybe that is a reasonable limitation, but it's a bit of a workaround to deal with.

TASK: [ansiblebit.oracle-java | echo oracle_java_task_installed] ************** 
<machine> ESTABLISH CONNECTION FOR USER: user
ok: [machine] => {
    "msg": "oracle_java_task_installed={'msg': u'check mode not supported for shell', 'invocation': {'module_name': u'shell', 'module_complex_args': {}, 'module_args': u'which java'}, 'skipped': True}"
}

TASK: [ansiblebit.oracle-java | set fact oracle_java_installed] *************** 
<machine> ESTABLISH CONNECTION FOR USER: user
fatal: [machine] => One or more undefined variables: 'dict object' has no attribute 'rc'

FATAL: all hosts have already failed -- aborting

Depends on ansiblebit.launchpad-ppa-webupd8 even on Centos

Installing under CentOs gives the following error:

ERROR! the role 'ansiblebit.launchpad-ppa-webupd8' was not found in /home/klo/build-resources/ansible/roles:/etc/ansible/roles:/home/ko/build-resources/ansible/roles:/home/klo/build-resources/ansible

The error appears to have been in '/home/klo/build-resources/ansible/roles/ansiblebit.oracle-java/meta/main.yml': line 42, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

dependencies:
  - role: ansiblebit.launchpad-ppa-webupd8
    ^ here

Role detecting host (local) java. Deploying to Google Cloud Engine.

The IP is for the gce. The java version is on the host (local).
TASK [ansiblebit.oracle-java : determine if Java is already installed] *********
task path: /etc/ansible/roles/ansiblebit.oracle-java/tasks/check_environment.yml
ok: [35.188.98.134] => {"changed": false, "cmd": "which java", "delta": "0:00:00.002333", "end": "2017-07-19 18:07:23.761431", "failed": false, "failed_when_result": false, "rc": 0, "start": "2017-07-19 18:07:23.759098", "stderr": "", "stderr_lines": [], "stdout": "/usr/bin/java", "stdout_lines": ["/usr/bin/java"]}

TASK [ansiblebit.oracle-java : determine which Java version is installed] ******
task path: /etc/ansible/roles/ansiblebit.oracle-java/tasks/check_environment.yml:21
ok: [35.184.113.55] => {"changed": false, "cmd": "java -version", "delta": "0:00:00.055572", "end": "2017-07-19 18:07:23.994431", "rc": 0, "start": "2017-07-19 18:07:23.938859", "stderr": "java version "1.8.0_131"\nJava(TM) SE Runtime Environment (build 1.8.0_131-b11)\nJava HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)", "stderr_lines": ["java version "1.8.0_131"", "Java(TM) SE Runtime Environment (build 1.8.0_131-b11)", "Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)"], "stdout": "", "stdout_lines": []}

What am I doing wrong?

ansible: deprecation warning; using tests as filters

Currently I observe message like the following during run:

[DEPRECATION WARNING]: Using tests as filters is deprecated. Instead of using `result|changed` instead use `result is changed`. This feature will be removed in...

Currently I'm running on Ansible 2.5.2....

ansible-galaxy downloas old version (v4.14.2) of ansiblebit/oracle-java (instead of lastest 5.14.4)

ansible-galaxy -vvv install ansiblebit.oracle-java
Using /etc/ansible/ansible.cfg as config file
Opened /home/fedora/.ansible_galaxy
Installing role ansiblebit.oracle-java
Opened /home/fedora/.ansible_galaxy

cat ansiblebit.oracle-java/meta/.galaxy_install_info
{install_date: 'Fri Apr 14 12:42:57 2017', version: v4.14.2}

maybe it's due to the letter "v" on the version ?

Download Java 8 RPM Failed on CentOS7

The documentation is defining this

oracle_java_rpm_url: 'http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.rpm'

But it fails
Then I tried with :

http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.rpm

But it fails too

TASK [ansiblebit.oracle-java : download Java RPM ] ****************************************************************************[DEPRECATION WARNING]: Using tests as filters is deprecated. Instead of using `result|succeeded` use `result is succeeded`. This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
FAILED - RETRYING: download Java RPM http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.rpm (3 retries left).
FAILED - RETRYING: download Java RPM http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.rpm (2 retries left).
FAILED - RETRYING: download Java RPM http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.rpm (1 retries left).
fatal: [172.31.2.202]: FAILED! => {"attempts": 3, "changed": false, "module_stderr": "Shared connection to 172.31.2.202 closed.\r\n", "module_stdout": "sudo: il est nรฉcessaire de saisir un mot de passe\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

RPM not downloaded

TASK [oracle-java : download Java RPM] *****************************************
fatal: [vagrant]: FAILED! => {"changed": false, "dest": "/usr/local/src/jdk-8u121-linux-x64.rpm", "failed": true, "msg": "Request failed", "response": "HTTP Error 404: Not Found", "state": "absent", "status_code": 404, "url": "http://download.oracle.com/otn-pub/java/jdk/8u121-b13/jdk-8u121-linux-x64.rpm"}

Not sure how to address this, looks like correct URL is http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm

jinja2 warnings

as reported on #40

[WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}.

check_environment.yml stops with upgrade to Ansible 2.1.0

Running the plugin with Ansible 1.9.4 runs as expected. Upgrading to Ansible 2.0.0 and the role stops after check_environment.yml is included. Reverting to Ansible 1.9.4 and everything runs again.

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [newhost.mydomain.com]

TASK [ansiblebit.launchpad-ppa-webupd8 : if debian, include family specific task file] ***
skipping: [newhost.mydomain.com]

TASK [ansiblebit.launchpad-ppa-webupd8 : if ubuntu, include family specific task file] ***
skipping: [newhost.mydomain.com]

TASK [ansiblebit.launchpad-ppa-webupd8 : check if operating system is suported]
skipping: [newhost.mydomain.com]

TASK [ansiblebit.oracle-java : check host environment] *************************
included: /etc/ansible/roles/ansiblebit.oracle-java/tasks/check_environment.yml for newhost.mydomain.com

PLAY RECAP *********************************************************************
newhost.mydomain.com       : ok=2    changed=0    unreachable=0    failed=0

include_vars includes the wrong file for debian

If i have a structure like this in my role that includes this role

# my awesome-role tree output
.
โ”œโ”€โ”€ defaults
โ”‚ย ย  โ”œโ”€โ”€ Darwin.yml
โ”‚ย ย  โ”œโ”€โ”€ Debian.yml
โ”‚ย ย  โ””โ”€โ”€ main.yml
โ”œโ”€โ”€ handlers
โ”‚ย ย  โ””โ”€โ”€ main.yml
โ”œโ”€โ”€ meta
โ”‚ย ย  โ””โ”€โ”€ main.yml
โ”œโ”€โ”€ tasks
โ”‚ย ย  โ”œโ”€โ”€ main.yml

then this task

- name: include OS family/distribution specific variables
  include_vars: "{{ item }}"
  with_first_found:
    - "../defaults/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
    - "../defaults/{{ ansible_distribution | lower }}.yml"
    - "../defaults/{{ ansible_os_family | lower }}.yml"

includes my own Debian.yml (awesome-role/defaults/Debian.yml) instead of ansiblebit/oracle-java/defaults/Debian.yml and then the role fails with undefined variables

[...]
==> ubuntu_xenial64: TASK [ansiblebit.oracle-java : include OS family/distribution specific variables] ***
==> ubuntu_xenial64: ok: [localhost] => (item=/home/ubuntu/awesome-role/vars/../defaults/debian.yml)
==> ubuntu_xenial64:
[...]
==> ubuntu_xenial64: TASK [ansiblebit.oracle-java : ensure Java is installed] ***********************
==> ubuntu_xenial64: fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'oracle_java_state' is undefined\n\nThe error appears to have been in '/home/ubuntu/.ansible-roles/ansiblebit.oracle-java/tasks/debian/main.yml': line 12, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: ensure Java is installed\n  ^ here\n"}

As a workaround i've manually defined the contents of defaults/debian.yml in my awesome-role/defaults/Debian.yml and its working.

Oracle java 7 for debian based system

when trying to install oracle version of java 7 I getting "msg: No package matching 'oracle-java7-installer' is available" and I think is because after you add the repo the roles is not making any update before trying yo install the package. I'm using Ubuntu server 14.04.

Error at "determine latest java download page and version"

Since a few days, installation of Java doesn't work anymore. It throws this error at task "determine latest java download page and version":

The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'content'\n\nThe error appears to have been in '/Users/remo.wenger/.ansible/roles/ansiblebit.oracle-java/tasks/redhat/main.yml

Module version: 5.14.12 (we're not using 5.14.14 because issue #78)
Ansible version: 2.5.0 and 2.5.4

module variables:
oracle_java_version: 8

It could have something to do with the JDK10 release and a change of the Oracle download page:
http://www.oracle.com/technetwork/java/javase/downloads/index.html

redhat: download failing

This task is failing after not using it for about 2 months.

It seems the role is a bit fragile due needing to parse links out of the Oracle website? Is there any way to specify direct download links so I can cache my own versions in Artifactory?

System is Fedora 23 (4.8.13-100.fc23.x86_64)

The role is being used as follows:

  roles:
    - role: ansiblebit.oracle-java
      become: yes
      oracle_java_version: 8
      oracle_java_set_as_default: true

Full text of error:

TASK [ansiblebit.oracle-java : define download page URL based on latest version] *****************************************************************
[DEPRECATION WARNING]: Using tests as filters is deprecated. Instead of using `result|version_compare` use `result is version_compare`. This 
feature will be removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'latest_java_page_and_version[1] | version_compare(oracle_java_version,'=')' failed. The error was: Version comparison: list object has no element 1\n\nThe error appears to have been in '<snip>/ansiblebit.oracle-java/tasks/redhat/main.yml': line 19, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: define download page URL based on latest version\n  ^ here\n"}

Failed to install on CentOS 7

With this minimal yml file:

---
- hosts: all
  remote_user: corda
  become: True
  roles:
    - { role: ansiblebit.oracle-java, oracle_java_set_as_default: yes }

I see following error:
fatal: [tc-networkmap.corda.r3cev.com]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to tc-networkmap.corda.r3cev.com closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_oc9Jcs/ansible_module_yum.py\", line 1267, in <module>\r\n main()\r\n File \"/tmp/ansible_oc9Jcs/ansible_module_yum.py\", line 1258, in main\r\n params['installroot'])\r\n File \"/tmp/ansible_oc9Jcs/ansible_module_yum.py\", line 1157, in ensure\r\n res = install(module, pkgs, repoq, yum_basecmd, conf_file, en_repos, dis_repos, installroot=installroot)\r\n File \"/tmp/ansible_oc9Jcs/ansible_module_yum.py\", line 677, in install\r\n nvra = local_nvra(module, spec)\r\n File \"/tmp/ansible_oc9Jcs/ansible_module_yum.py\", line 585, in local_nvra\r\n header = ts.hdrFromFdno(fd)\r\n File \"/usr/lib64/python2.7/site-packages/rpm/transaction.py\", line 160, in hdrFromFdno\r\n raise rpm.error(\"error reading package header\")\r\n_rpm.error: error reading package header\r\n", "msg": "MODULE FAILURE", "rc": 0}

That's my Ansible version

ansible --version
ansible 2.3.1.0
  config file = /Users/wawrzek/.ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, May 10 2017, 12:13:02) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]

galaxy: import warnings

INFO Starting import: task_id=275247, repository=ansiblebit/oracle-java
INFO Content search - Looking for file "apb.yml"
INFO Content search - Looking for top level role metadata file
WARNING [role] Missing 'dependencies' field in metadata.
INFO [role] Linting...
ERROR [role] ./tests/plugins/callback/idempotence.py:8:1: F401 'ansible.constants as C' imported but unused
ERROR [role] ./tests/plugins/callback/idempotence.py:50:1: W391 blank line at end of file
ERROR [role] ./tasks/darwin/macosx.yml:39:1: [error] too many blank lines (1 > 0) (empty-lines)
ERROR [role] ./tests/tasks/main.yml:44:1: [error] too many blank lines (1 > 0) (empty-lines)
ERROR Lint failed
INFO [role] Found Content instance: id=3375, content_type="role", name="oracle-java"
INFO [role] Adding role metadata tags
INFO [role] Adding role platforms
WARNING [role] Invalid platform: "CentOS-all", skipping.
WARNING [role] Invalid platform: "RedHat-all", skipping.
INFO Updating repository versions...
Import completed

JDK download page get fails with infinite redirect

It's not possible to use this role on CentOS due to the following error:

TASK [oracle-java : get latest JDK download page]
fatal: [host.domain]: FAILED! => {"changed": false, "connection": "close", "content": "", "content_length": "0", "date": "Mon, 25 Sep 2017 14:27:36 GMT", "failed": true, "location": "http://www.oracle.com/splash/www/fw_error.html?referenceerror=18.c3a7f7c1.1506349656.7e17de8&referer=http://www.oracle.com/splash/www/fw_error.html", "msg": "Status code was not [200]: HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.\nThe last 30x error message was:\nMoved Temporarily", "redirected": false, "server": "AkamaiGHost", "status": 302, "url": "http://www.oracle.com/technetwork/java/javase/downloads/index.html"}

I tried modifying the user agent, but that did not help. Probably because they have some kind of automatic blacklisting?
Is there anything I can do to avoid this problem?

Issue with oracle_java_rpm_url variable

I'm not sure what causes it yet ๐Ÿ˜•
This playbook doesn't work:

---
- hosts: all
  roles:
     - role: ansiblebit.oracle-java
  vars:
    oracle_java_rpm_url: "http://download.oracle.com/otn-pub/java/jdk/{{ oracle_java_version }}u{{ oracle_java_version_update }}-b{{ oracle_java_version_build }}/d54c1d3a095b4ff2b6607d096fa80163/{{ oracle_java_rpm_filename }}"
    oracle_java_version_update: 131
    oracle_java_version_build: 11

If I put the oracle_java_rpm_url variable near the role it works:

---
- hosts: all
  roles:
     - { role: ansiblebit.oracle-java, oracle_java_rpm_url: "http://download.oracle.com/otn-pub/java/jdk/{{ oracle_java_version }}u{{ oracle_java_version_update }}-b{{ oracle_java_version_build }}/d54c1d3a095b4ff2b6607d096fa80163/{{ oracle_java_rpm_filename }}" }
  vars:
    oracle_java_version_update: 131
    oracle_java_version_build: 11

galaxy error

Starting import 552: role_name=oracle-java repo=ansiblebit/oracle-java ref=
Retrieving Github repo ansiblebit/oracle-java
Accessing branch: develop
Parsing and validating meta/main.yml
Setting role name to oracle-java
Parsing galaxy_tags
Found galaxy_info.categories. Update meta/main.yml to use galaxy_info.galaxy_tags.
Parsing platforms
Invalid platform: MacOSX-10.10.2 (skipping)
Invalid platform: MacOSX-10.10.1 (skipping)
Invalid platform: MacOSX-10.9.5 (skipping)
Invalid platform: MacOSX-10.9.4 (skipping)
Invalid platform: MacOSX-10.9.3 (skipping)
Invalid platform: MacOSX-10.9.2 (skipping)
Invalid platform: MacOSX-10.9.1 (skipping)
Adding dependencies
Parsing and validating README.md
Adding repo tags as role versions
Import completed
Status FAILED : warnings=1 errors=7
An error occurred while saving the role: value too long for type character varying(256)

Failed to install on Ubuntu 16.04

fatal: [build-production-bastion-0]: FAILED! => {"cache_update_time": 1499448066, "cache_updated": false, "changed": false, "failed": true, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'oracle-java8-installer'' failed: E: Sub-process /usr/bin/dpkg returned an error code (1)\n", "rc": 100, "stderr": "E: Sub-process /usr/bin/dpkg returned an error code (1)\n", "stderr_lines": ["E: Sub-process /usr/bin/dpkg returned an error code (1)"], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\noracle-java8-installer is already the newest version (8u131-1~webupd8~2).\nThe following packages were automatically installed and are no longer required:\n  libfontenc1 libxfont1\nUse 'sudo apt autoremove' to remove them.\n0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.\n1 not fully installed or removed.\nAfter this operation, 0 B of additional disk space will be used.\nSetting up oracle-java8-installer (8u131-1~webupd8~2) ...\r\nUsing wget settings from /var/cache/oracle-jdk8-installer/wgetrc\r\nDownloading Oracle Java 8...\r\n--2017-07-07 17:40:02--  http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz\r\nResolving download.oracle.com (download.oracle.com)... 118.214.160.251, 118.214.160.203\r\nConnecting to download.oracle.com (download.oracle.com)|118.214.160.251|:80... connected.\r\nHTTP request sent, awaiting response... 302 Moved Temporarily\r\nLocation: https://edelivery.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz [following]\r\n--2017-07-07 17:40:02--  https://edelivery.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz\r\nResolving edelivery.oracle.com (edelivery.oracle.com)... 23.49.182.138, 2600:1408:7:296::2d3e, 2600:1408:7:2a0::2d3e\r\nConnecting to edelivery.oracle.com (edelivery.oracle.com)|23.49.182.138|:443... connected.\r\nHTTP request sent, awaiting response... 302 Moved Temporarily\r\nLocation: http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz?AuthParam=1499449322_c8ef9c3e4a44fad6b0c66e937a62e88b [following]\r\n--2017-07-07 17:40:02--  http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz?AuthParam=1499449322_c8ef9c3e4a44fad6b0c66e937a62e88b\r\nConnecting to download.oracle.com (download.oracle.com)|118.214.160.251|:80... connected.\r\nHTTP request sent, awaiting response... 416 Requested Range Not Satisfiable\r\n\r\n    The file is already fully retrieved; nothing to do.\r\n\r\nDownload done.\r\nRemoving outdated cached downloads...\r\nsha256sum mismatch jdk-8u131-linux-x64.tar.gz\r\nOracle JDK 8 is NOT installed.\r\ndpkg: error processing package oracle-java8-installer (--configure):\r\n subprocess installed post-installation script returned error exit status 1\r\nErrors were encountered while processing:\r\n oracle-java8-installer\r\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "oracle-java8-installer is already the newest version (8u131-1~webupd8~2).", "The following packages were automatically installed and are no longer required:", "  libfontenc1 libxfont1", "Use 'sudo apt autoremove' to remove them.", "0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.", "1 not fully installed or removed.", "After this operation, 0 B of additional disk space will be used.", "Setting up oracle-java8-installer (8u131-1~webupd8~2) ...", "Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc", "Downloading Oracle Java 8...", "--2017-07-07 17:40:02--  http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz", "Resolving download.oracle.com (download.oracle.com)... 118.214.160.251, 118.214.160.203", "Connecting to download.oracle.com (download.oracle.com)|118.214.160.251|:80... connected.", "HTTP request sent, awaiting response... 302 Moved Temporarily", "Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz [following]", "--2017-07-07 17:40:02--  https://edelivery.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz", "Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.49.182.138, 2600:1408:7:296::2d3e, 2600:1408:7:2a0::2d3e", "Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.49.182.138|:443... connected.", "HTTP request sent, awaiting response... 302 Moved Temporarily", "Location: http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz?AuthParam=1499449322_c8ef9c3e4a44fad6b0c66e937a62e88b [following]", "--2017-07-07 17:40:02--  http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz?AuthParam=1499449322_c8ef9c3e4a44fad6b0c66e937a62e88b", "Connecting to download.oracle.com (download.oracle.com)|118.214.160.251|:80... connected.", "HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable", "", "    The file is already fully retrieved; nothing to do.", "", "Download done.", "Removing outdated cached downloads...", "sha256sum mismatch jdk-8u131-linux-x64.tar.gz", "Oracle JDK 8 is NOT installed.", "dpkg: error processing package oracle-java8-installer (--configure):", " subprocess installed post-installation script returned error exit status 1", "Errors were encountered while processing:", " oracle-java8-installer"]}

Role updates Java even when state=present (it shouldn't)

With state=present, the role shouldn't update Java with the latest version, yet it does.
It should update to latest when state=latest, but not state=present.

This is on Debian family, as on Red Hat, you need to specify specific Java version.

Thank you!

Ubuntu Installation of Java 8 example points to Java 10 files

The current example to install Java 8 on Ubuntu with this role says:

- role: ansiblebit.oracle-java
        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_set_as_default: no
        oracle_java_state: latest

But it should say:

- role: ansiblebit.oracle-java
        oracle_java_use_defaults: no
        oracle_java_apt_repository: "ppa:webupd8team/java"
        oracle_java_cache_valid_time: 3600
        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_set_as_default: no
        oracle_java_state: latest

galaxy warning

Found galaxy_info.categories. Update meta/main.yml to use galaxy_info.galaxy_tags.

JRE or JRE-server support

Would be great if jre or even better jre-server would be supported. Most of the time JDK is not necessary and you're better off running the smaller executables.

version: use releasesoftwaremoreoften.com

https://releasesoftwaremoreoften.com/latestversion?name=oraclejdk8

https://releasesoftwaremoreoften.com/latestversion?name=oraclejdk9

Example:

- name: get latest version information json url
  uri:
    url: http://releasesoftwaremoreoften.com/latestversion?name=firefox
    return_content: yes
  register: firefox_latest_version_info_url

- name: set firefox latest version information
  set_fact: firefox_latest_version_info="{{ firefox_latest_version_info_url.content }}"

- name: set latest version
  set_fact: firefox_version_latest="{{ firefox_latest_version_info.latestVersion }}"

- name: set latest checksum
  set_fact: firefox_checksum_latest="{{ firefox_latest_version_info.checksum }}"

[DEPRECATION WARNING]: The use of 'include' for tasks has been deprecated.

[DEPRECATION WARNING]: The use of 'include' for tasks has been deprecated. Use 
'import_tasks' for static inclusions or 'include_tasks' for dynamic inclusions.
 This feature will be removed in a future release. Deprecation warnings can be 
disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: include is kept for backwards compatibility but usage is
 discouraged. The module documentation details page may explain more about this
 rationale.. This feature will be removed in a future release. Deprecation 
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

change sudo to become

[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default).
This
feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.

General role behaviour Debian vs RedHat

If this role runs on Debian it will install the latest version of Oracle JDK due to state=latest
For RedHat it will install whatever version is defined in defaults or someone changes the variables to another specific version.
I like to provide a change here as pull request.
Either

  • the role will also for RedHat get the latest version installed by default
    or
  • it stays as it is now, but when an additional variable is set, it will change the default variables to reflect the latest available version. (oracle_java_latest = True)

debian: alternative method to install Java

http://download.oracle.com/otn-pub/java/jdk/8u144-b01/XXXXXXXXXXXXXXXXXXXX/jdk-8u144-linux-x64.tar.gz", "Resolving download.oracle.com (download.oracle.com)... 2.16.4.178, 2.16.4.176", "Connecting to download.oracle.com (download.oracle.com)|2.16.4.178|:80... connected.", "HTTP request sent, awaiting response... 302 Moved Temporarily", "Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u144-b01/XXXXXXXXXXXXXXXXXXXXXX/jdk-8u144-linux-x64.tar.gz [following]", "--2017-10-18 07:24:42-- https://edelivery.oracle.com/otn-pub/java/jdk/8u144-b01/XXXXXXXXXXXXXXXXXXXXXX/jdk-8u144-linux-x64.tar.gz", ... "Connecting to download.oracle.com (download.oracle.com)|2.16.4.178|:80... connected.", "HTTP request sent, awaiting response... 404 Not Found", "2017-10-18 07:24:43 ERROR 404: Not Found.", "", "download failed"

Deprecation warnings

 [WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{ latest_java_page_and_version[1]|version_compare(oracle_java_version,'=') }}

jdk9

when the version is set to 9, the ansible run fails

TASK [ansiblebit.oracle-java : get lastest JDK rpm url] ************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "unknown url type: None"}

Disable debug by default

Thanks for writing this excellent role.

I'd recommend to have debug output disabled by default. Seems to be more logical. By default I just want to use the role and I don't care about the output. Only when I have problems, I'd like to enable debug output. Now I have to use --skip-tag=debug to all my commands to not get spammed with unnecessary output.

redhat: document oracle_java_download_timeout and increase default value

I believe the timeouts are inadequate for Oracle's current responsiveness. For a Redhat class system we experienced multiple failures today; I externally overrode the default 10 sec timeout in defaults/redhat.yml with 1000 sec and it completed in ~25 sec. I recommend upping the defaults to at least 30 and preferrably 60; also, publicizing awareness of the oracle_java_download_timeout variable in case people see more failures.

RedHat/Amazon Linux: role fails when setting Java version as default

TASK [ansiblebit.oracle-java : set Java version as default] *******************************************************************************************************************************************************************************************************
[DEPRECATION WARNING]: Using tests as filters is deprecated. Instead of using `result|changed` instead use `result is changed`. This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.
failed: [xx.xx.xx.xx] (item={'path': '/usr/java/jdk1.8.0_171/jre/bin', 'exe': 'java'}) => {"changed": false, "item": {"exe": "java", "path": "/usr/java/jdk1.8.0_171/jre/bin"}, "msg": "Specified path /usr/java/jdk1.8.0_171/jre/bin/java does not exist"}
failed: [xx.xx.xx.xx] (item={'path': '/usr/java/jdk1.8.0_171/jre/bin', 'exe': 'keytool'}) => {"changed": false, "item": {"exe": "keytool", "path": "/usr/java/jdk1.8.0_171/jre/bin"}, "msg": "Specified path /usr/java/jdk1.8.0_171/jre/bin/keytool does not exist"}
failed: [xx.xx.xx.xx] (item={'path': '/usr/java/jdk1.8.0_171/bin', 'exe': 'javac'}) => {"changed": false, "item": {"exe": "javac", "path": "/usr/java/jdk1.8.0_171/bin"}, "msg": "Specified path /usr/java/jdk1.8.0_171/bin/javac does not exist"}
failed: [xx.xx.xx.xx] (item={'path': '/usr/java/jdk1.8.0_171/bin', 'exe': 'javadoc'}) => {"changed": false, "item": {"exe": "javadoc", "path": "/usr/java/jdk1.8.0_171/bin"}, "msg": "Specified path /usr/java/jdk1.8.0_171/bin/javadoc does not exist"}

When running this role on Amazon Linux (which is based on RHEL) the role fails during the set Java version as default task. It seems to be using the wrong path for the java installation directory (/usr/java/jdk1.8.0_171) rather than the correct path (/usr/java/jdk1.8.0_171-amd64).

I ran this role using the default configuration.

roles:
  - name: install Oracle JDK 8
    role: ansiblebit.oracle-java
    oracle_java_set_as_default: yes

debian: mimic redhat installation strategy

I was updating a RedHat server and the latest JDK7 updated as expected, set itself as latest and default (as expected since I set that flag). However, it removed the existing JDK version. It still works for what I need it to do but I expected the new JDK would be set as latest and the old version would remain.

Thanks for all the hard work. Steve

I see that this is not tested against centos 6

Does this mean you simply dont run that test? Or, do you know for a fact that it wont work on centos 6?

I'm running into errors with the ansible yum package from python 2.6 not being able to read the rpm header.

"module_stderr": "",
"module_stdout": "Traceback (most recent call last):\r\n File "/tmp/ansible_sU5b4e/ansible_module_yum.py", line 1084, in \r\n main()\r\n File "/tmp/ansible_sU5b4e/ansible_module_yum.py", line 1073, in main\r\n disablerepo, disable_gpg_check, exclude, repoquery)\r\n File "/tmp/ansible_sU5b4e/ansible_module_yum.py", line 989, in ensure\r\n res = install(module, pkgs, repoq, yum_basecmd, conf_file, en_repos, dis_repos)\r\n File "/tmp/ansible_sU5b4e/ansible_module_yum.py", line 591, in install\r\n nvra = local_nvra(module, spec)\r\n File "/tmp/ansible_sU5b4e/ansible_module_yum.py", line 506, in local_nvra\r\n header = ts.hdrFromFdno(fd)\r\n File "/usr/lib64/python2.6/site-packages/rpm/transaction.py", line 154, in hdrFromFdno\r\n raise rpm.error("error reading package header")\r\n_rpm.error: error reading package header\r\n",

Oracle SSL issue

Hi, Been using this role on the latest release for the past week.

Today the role started to fail to download the RPM when using the following url:
oracle_java_rpm_url: http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm

If the validate_certs is set to no on the get_url request it will work successfully.
This has been working previously for the last week.

Error message:

docker: TASK [ansiblebit.oracle-java : download Java RPM] ******************************
    docker: fatal: [default]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to validate the SSL certificate for edelivery.oracle.com:443. Make sure your managed systems have a valid CA certificate installed. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/pki/ca-trust/extracted/pem, /etc/pki/tls/certs, /usr/share/ca-certificates/cacert.org, /etc/ansible"}

I found the edeliverysite is only used when the unauthorised page is displayed.

Two small items

These are just warnings and they did not cause any major issues - figured I'd report them just in case

When running this against a CentOS 7 system, using: ansible 2.3.0.0:

TASK [ansiblebit.oracle-java : define download page URL based on latest version] ******************************************************************
[WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{
latest_java_page_and_version[1]|version_compare(oracle_java_version,'=') }}

ok: [server1]

TASK [ansiblebit.oracle-java : get lastest JDK rpm url] *******************************************************************************************
[WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{
latest_java_page_and_version[1]|version_compare(oracle_java_version,'!=') and oracle_java_version }}

skipping: [server1]

TASK [ansiblebit.oracle-java : define download page URL for "8"] **********************************************************************************
[WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{
latest_java_page_and_version[1]|version_compare(oracle_java_version,'!=') and oracle_java_version }}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.