commit | author | age
|
bf37eb
|
1 |
# Ansible Role: Java |
EL |
2 |
|
|
3 |
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-java.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-java) |
|
4 |
|
|
5 |
Installs Java for RedHat/CentOS and Debian/Ubuntu linux servers. |
|
6 |
|
|
7 |
## Requirements |
|
8 |
|
|
9 |
None. |
|
10 |
|
|
11 |
## Role Variables |
|
12 |
|
|
13 |
Available variables are listed below, along with default values: |
|
14 |
|
|
15 |
# The defaults provided by this role are specific to each distribution. |
|
16 |
java_packages: |
|
17 |
- java-1.7.0-openjdk |
|
18 |
|
|
19 |
Set the version/development kit of Java to install, along with any other necessary Java packages. Some other options include are included in the distribution-specific files in this role's 'defaults' folder. |
|
20 |
|
|
21 |
java_home: "" |
|
22 |
|
|
23 |
If set, the role will set the global environment variable `JAVA_HOME` to this value. |
|
24 |
|
|
25 |
## Dependencies |
|
26 |
|
|
27 |
None. |
|
28 |
|
|
29 |
## Example Playbook (using default package, usually OpenJDK 7) |
|
30 |
|
|
31 |
- hosts: servers |
|
32 |
roles: |
|
33 |
- geerlingguy.java |
|
34 |
|
|
35 |
## Example Playbook (install OpenJDK 8) |
|
36 |
|
|
37 |
For RHEL / CentOS: |
|
38 |
|
|
39 |
- hosts: server |
|
40 |
roles: |
|
41 |
- role: geerlingguy.java |
|
42 |
when: "ansible_os_family == 'RedHat'" |
|
43 |
java_packages: |
|
44 |
- java-1.8.0-openjdk |
|
45 |
|
|
46 |
For Ubuntu < 16.04: |
|
47 |
|
|
48 |
- hosts: server |
|
49 |
tasks: |
|
50 |
- name: installing repo for Java 8 in Ubuntu |
|
51 |
apt_repository: repo='ppa:openjdk-r/ppa' |
|
52 |
|
|
53 |
- hosts: server |
|
54 |
roles: |
|
55 |
- role: geerlingguy.java |
|
56 |
when: "ansible_os_family == 'Debian'" |
|
57 |
java_packages: |
|
58 |
- openjdk-8-jdk |
|
59 |
|
|
60 |
## License |
|
61 |
|
|
62 |
MIT / BSD |
|
63 |
|
|
64 |
## Author Information |
|
65 |
|
|
66 |
This role was created in 2014 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/). |