Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Oracle Java 8 using Ansible [duplicate]

Tags:

java

ansible

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

This installer has 2 full screen prompts and ansible fails when trying to install this package.

- name: Add Oracle Java PPA
  apt_repository:
    repo: ppa:webupd8team/java
    state: present

- name: Install Java 8
  apt:
    name: oracle-java8-installer
    update_cache: yes
like image 749
user2066480 Avatar asked May 25 '18 20:05

user2066480


1 Answers

https://github.com/malk/ansible-java8-oracle

---
- name: Install add-apt-repostory
  become: yes
  apt: name=software-properties-common state=latest

- name: Add Oracle Java Repository
  become: yes
  apt_repository: repo='ppa:webupd8team/java'

- name: Accept Java 8 License
  become: yes
  debconf: name='oracle-java8-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select'

- name: Install Oracle Java 8
  become: yes
  apt: name={{item}} state=latest
  with_items:
    - oracle-java8-installer
    - ca-certificates
    - oracle-java8-set-default
like image 75
user2066480 Avatar answered Sep 17 '22 02:09

user2066480