zzdapg
Last Updated: February 25, 2016
·
8.664K
· nosolopau
Avatar

Ansible recipe to install Java 7 (selecting the Oracle license)

The new Java 7 package requires accepting the Oracle license. This "feature" can be harmful both for automation and world peace since the installer refuses to continue without interactive mode:

Unpacking oracle-java7-installer (from .../oracle-java7-installer_7u51-0~webupd8~1_all.deb) ...

oracle-license-v1-1 license could not be presented
try 'dpkg-reconfigure debconf' to select a frontend other than noninteractive

I found this solution: http://www.markhneedham.com/blog/2013/04/18/puppet-installing-oracle-java-oracle-license-v1-1-license-could-not-be-presented/ but for some reason doesn't work for me. After some research finally I arrived to the solution: https://github.com/vrischmann/ansible-role-java/blob/master/tasks/oracle.yml, ready for Ansible :).

Here is the correct recipe:

---

- name: Add JRE ppa
  apt_repository: repo=ppa:webupd8team/java state=present

- name: Automatically select the Oracle License
  shell: echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections

- name: Install JRE
  apt: pkg=oracle-java7-installer state=latest update-cache=yes force=yes

:)

Say Thanks
Respond

2 Responses
Add your response

18272
None

Thank you very much. After one year, this post still useful :)

over 1 year ago ·
18327
0 g13ym4l txivazbigrhtmskay0fzanbihbz3mu3dtm1ea 8wmzathrvik bbtlnfiri8tp1hisza

Thanks for such a nice playbook, but we can use the debconf module to accept the license.

debconf: name='oracle-java7-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select'

over 1 year ago ·
Filed Under