-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-and-config-tomcat.yml
44 lines (44 loc) · 1.33 KB
/
install-and-config-tomcat.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
- name: Install and configure tomcat
hosts: all
gather_facts: false
vars:
req_java: java-1.8.0-openjdk
set_java: jre-1.8.0-openjdk
req_tomcat_ver: 9.0.30
tomcat_url: http://mirrors.estointernet.in/apache/tomcat/tomcat-{{req_tomcat_ver.split('.')[0]}}
tomcat_port: 8090
become: yes
tasks:
- name: updating repos
yum:
name: "*"
state: latest
-name: Installing required java
yum:
name: "{{req_java}}"
state: present
- name: Setting default java
alternatives:
name: java
link: /usr/bin/java
path: /usr/lib/jvm/{{set_java}}/bin/java
- name: Downloading required tomcat
get_url:
url: "{{tomcat_url}}"
dest: /usr/local
- name: Extracting downloaded tomcat
unarchive:
src: "/usr/local/apache-tomcat-{{req_tomcat_ver}}.tar.gz"
dest: /usr/local
remote_src: yes
- name: Renaming tomcat home
command: mv /usr/local/apache-tomcat-{{req_tomcat_ver}} /usr/local/latest
- name: Replacing default port with required port
template:
src: server.xml.j2
dest: /usr/local/latest/confserver.xml
- name: Starting tomcat
service:
name: httpd
state: started