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