Last active
November 12, 2015 11:01
-
-
Save milovtim/7c3fbdaa283bfaaeb996 to your computer and use it in GitHub Desktop.
This file contains 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: Install java 8 (oracle) and set up tomcat8 service | |
hosts: vbox | |
become: yes | |
vars: | |
JAVA_HOME: /usr/lib/jvm/java-8-oracle | |
tasks: | |
- name: add webupd key for webupd | |
command: apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 | |
when: ansible_os_family == "Debian" | |
- name: add webupd repo for java 8 | |
apt_repository: repo='deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' | |
when: ansible_os_family == "Debian" | |
- name: accept oracle license before install java | |
shell: echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections | |
- name: install java 8 | |
apt: name=oracle-java8-installer | |
- name: Install tomcat8 package | |
apt: name=tomcat8 state=latest | |
- shell: readlink -f /usr/bin/java | sed "s:bin/java::" | |
register: javahome | |
- name: Print JAVA_HOME in system | |
debug: var=javahome.stdout | |
- name: Set JAVA_HOME in tomcat8 script (/etc/default/tomcat8) | |
replace: dest=/etc/default/tomcat8 regexp="^#?JAVA_HOME.+" replace="JAVA_HOME={{javahome.stdout}}" | |
- name: tomcat8 service started | |
service: name=tomcat8 state=started |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment