Skip to content

Instantly share code, notes, and snippets.

@fclairamb
Created April 7, 2013 15:58
Show Gist options
  • Save fclairamb/5331052 to your computer and use it in GitHub Desktop.
Save fclairamb/5331052 to your computer and use it in GitHub Desktop.
Ansible playbook to install Java automatically on Debian. I'm pretty sure you have to read and accept the java license before installing this. Using apt module surely is better but it requires to have python-apt installed.
- name: Java install
hosts: do
user: root
tasks:
- name: Create java repo list
action: shell echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main' >/etc/apt/sources.list.d/java.list
- name: Add repo key
action: command apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
- name: Accept java license
action: shell echo 'oracle-java7-installer shared/accepted-oracle-license-v1-1 select true' | debconf-set-selections
- name: Update
action: command apt-get update -y
- name: Install java 7
action: command apt-get install oracle-java7-set-default -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment