Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ansible playbook for installing Oracle Java 7 on Debian
# Ansible playbook to install Java 7 on Debian
#
# Thanks to http://www.sysadminslife.com/linux/howto-oracle-sun-java-7-installation-unter-debian-6-squeeze/
#
# Author: Gabriel Birke <gb@birke-software.de>
- hosts: devroot
vars:
java_download: http://download.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.tar.gz
java_name: jdk1.7.0_45
download_folder: /usr/src
java_archive: "{{download_folder}}/{{java_name}}.tar.gz"
java_folder: /usr/lib/jvm
java_alias: java-7-oracle
tasks:
- name: Install wget
apt: pkg=wget
- name: Download Java
command: 'wget -q -O {{java_archive}} --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" {{java_download}} creates={{java_archive}}'
- name: Extract Java archive
command: "tar -xzf {{java_archive}} -C {{download_folder}} creates={{download_folder}}/{{java_name}}"
- name: Fix ownership
file: "state=directory path={{download_folder}}/{{java_name}} owner=root group=root recurse=yes"
- name: Create Java folder
file: "state=directory path={{java_folder}}"
- name: Move Java to final folder
command: "mv {{download_folder}}/{{java_name}} {{java_folder}} creates={{java_folder}}/{{java_name}}"
- name: Create symlink for easier update
file: "state=link src={{java_folder}}/{{java_name}} dest={{java_folder}}/{{java_alias}}"
- name: Make Java available for system
command: 'update-alternatives --install "/usr/bin/java" "java" "{{java_folder}}/{{java_alias}}/bin/java" 1'
@keltik85

This comment has been minimized.

Copy link

keltik85 commented May 10, 2016

The "Download Java" task only downloads some broken tar.gz file which cannot be unpacked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.