52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
---
|
|
# Ubuntu.
|
|
- name: Add repository for OpenJDK 8 (Ubuntu 14).
|
|
apt_repository: repo='ppa:openjdk-r/ppa'
|
|
when:
|
|
- ansible_distribution == "Ubuntu"
|
|
- ansible_distribution_version == "14.04"
|
|
|
|
# Debian.
|
|
- name: Enable Backports repository (Debian 8).
|
|
apt_repository:
|
|
repo: 'deb http://ftp.debian.org/debian {{ ansible_distribution_release }}-backports main'
|
|
state: present
|
|
filename: "{{ ansible_distribution_release }}_backports"
|
|
when: ansible_distribution == "Debian"
|
|
|
|
- name: Update apt cache.
|
|
apt: update_cache=yes cache_valid_time=600
|
|
when: ansible_os_family == 'Debian'
|
|
changed_when: false
|
|
|
|
# See: http://unix.stackexchange.com/a/342469
|
|
- name: Install dependencies.
|
|
apt:
|
|
default_release: "{{ ansible_distribution_release }}-backports"
|
|
name:
|
|
- openjdk-8-jre-headless
|
|
- ca-certificates-java
|
|
state: present
|
|
when: ansible_distribution == "Debian"
|
|
|
|
# Red Hat.
|
|
- name: Set the java_packages variable (RedHat).
|
|
set_fact:
|
|
java_packages:
|
|
- java-1.8.0-openjdk
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
# Ubuntu.
|
|
- name: Set the java_packages variable (Ubuntu).
|
|
set_fact:
|
|
java_packages:
|
|
- openjdk-8-jdk
|
|
when: ansible_distribution == 'Ubuntu'
|
|
|
|
# Debian.
|
|
- name: Set the java_packages variable (Debian).
|
|
set_fact:
|
|
java_packages:
|
|
- openjdk-8-jdk
|
|
when: ansible_distribution == 'Debian'
|