Created
July 24, 2013 10:45
-
-
Save owainlewis/6069582 to your computer and use it in GitHub Desktop.
Install Java 7 with Ansible on Ubuntu Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: ensure required packages are installed for Java 7 | |
apt: name=$item state=latest update_cache=yes | |
with_items: | |
- python-software-properties | |
- name: Add Java repository to sources | |
action: apt_repository repo='ppa:webupd8team/java' | |
- name: Autoaccept license for Java | |
action: shell echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections | |
- name: Update APT package cache | |
action: apt update_cache=yes | |
- name: Install Java 7 | |
action: apt pkg=oracle-java7-installer state=latest install_recommends=yes | |
- name: Set Java 7 Env | |
action: apt pkg=oracle-java7-set-default state=latest install_recommends=yes |
Thanks, working for me too :-)
new:
debconf: name='oracle-java7-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select'
deprecated:
action: shell echo ... | sudo /usr/bin/debconf-set-selections
Wish I had read further down - just worked out @tamsky's solution by myself 😄
Thanks!
To make it working (Ubuntu 14.04 LTS) I had to change a detail:
- name: ensure required packages are installed for Java 7
apt: name=$item state=latest update_cache=yes
with_items:
- python-software-properties
with
- name: ensure required packages are installed for Java 7
apt: name={{item}} state=latest update_cache=yes
with_items:
- python-software-properties
Thanks a lot.
Thanks it worked for me too, for java 8 ... just by making some small changes.
ERROR! 'apt' is not a valid attribute for a Play
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks. It works!