-
Notifications
You must be signed in to change notification settings - Fork 146
/
Copy pathansible_playbook_configure_tomcat_amazon_linux.yml
54 lines (54 loc) · 1.88 KB
/
ansible_playbook_configure_tomcat_amazon_linux.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
45
46
47
48
49
50
51
52
53
54
---
- name: Install and configure tomcat
hosts: 3.89.155.217
gather_facts: false
vars:
java_v: java-1.8.0-openjdk
set_java: jre-1.8.0-openjdk.x86_64
tomcat_port: 8181
tomcat_version: 8.5.55
tomcat_url: "https://mirror.csclub.uwaterloo.ca/apache/tomcat/tomcat-{{tomcat_version.split('.')[0]}}/v{{tomcat_version}}/bin/apache-tomcat-{{tomcat_version}}.tar.gz"
become: yes
tasks:
- name: Updating repos
yum:
name: "*"
state: latest
- name: Installing Openjdk
yum:
name: "{{java_v}}"
state: present
- name: Setting default Java
alternatives:
name: java
link: /usr/bin/java
path: /usr/lib/jvm/{{set_java}}/bin/java
- name: Downloading tomcat
get_url:
url: "{{tomcat_url}}"
dest: /usr/local
- name: Extracting downloaded tar file
unarchive:
src: "/usr/local/apache-tomcat-{{tomcat_version}}.tar.gz"
dest: /usr/local
remote_src: yes
- name: Renaming tomcat home
command: mv /usr/local/apache-tomcat-{{tomcat_version}} /usr/local/tomcat
- name: replace tomcat port in server config
template:
src: server.xml.j2
dest: /usr/local/tomcat/conf/server.xml
- name: Updating users and role
template:
src: tomcat-users.xml
dest: /usr/local/tomcat/conf/tomcat-users.xml
- name: Updating context xml restriction
template:
src: context-manager.xml
dest: /usr/local/tomcat/webapps/manager/META-INF/context.xml
- name: Updating restriction for host manager context
template:
src: context-hostmanager.xml
dest: /usr/local/tomcat/webapps/host-manager/META-INF/context.xml
- name: Starting tomcat
shell: nohup /usr/local/tomcat/bin/startup.sh &