Skip to content

Instantly share code, notes, and snippets.

@tekei
Created February 27, 2016 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tekei/fad7e700187ad26b0561 to your computer and use it in GitHub Desktop.
Save tekei/fad7e700187ad26b0561 to your computer and use it in GitHub Desktop.
install oracle java 1.8.0_45 use "williamyeh.oracle" (ansible-garaxy)
#!/bin/sh
ANSIBLE_DIR=$1
mkdir -p ${ANSIBLE_DIR}/roles
cd ${ANSIBLE_DIR}
cat << EOS > galaxy.yml
# java install
- src: williamyeh.oracle-java
EOS
ansible-galaxy install -p ./roles -r galaxy.yml
rm galaxy.yml
# add 1.8.0_74 env.
cat << EOS >> ./roles/williamyeh.oracle-java/tasks/set-role-variables.yml
- name: set internal vars for 1.8.0_*
set_fact:
jdk_version: 1.8.0_{{java_subversion}}
jdk_tarball_file: jdk-{{java_version}}u{{java_subversion}}-linux-{{ jdk_arch }}
jdk_tarball_url: http://download.oracle.com/otn-pub/java/jdk/{{java_version}}u{{java_subversion}}-b02/jdk-{{java_version}}u{{java_subversion}}-linux-{{ jdk_arch }}
when: java_version == 8 and java_subversion == 74
EOS
sed -i -e 's/java_subversion:.*$/java_subversion: 74/' ./roles/williamyeh.oracle-java/defaults/main.yml
sed -i -e 's/java_subversion:.*$/java_subversion: 74/' ./roles/williamyeh.oracle-java/prefetch.yml
---
- hosts: localhost
connection: local
become: yes
roles:
- { role: williamyeh.oracle-java, java_version: 8 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment