Last Updated: September 09, 2019
· nosolopau

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: but for some reason doesn't work for me. After some research finally I arrived to the solution:, 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


2 Responses
Add your response

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

over 1 year ago ·

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 ·